Skip to content

Conversation

jondkinney
Copy link
Contributor

I was getting errors in some files that had unicode characters in them. This seems to fix/ignore that and let the files be formatted still.

Command failed: erb-format --tailwind-output-path app/assets/builds/tailwind.css --stdin-filename "/Users/jon/Code/Seckret-Project/app/views/home/index.html.erb" --print-width 120
/Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/lib/erb/formatter.rb:101:in `gsub!': invalid byte sequence in US-ASCII (ArgumentError)

    @source.gsub!(ERB_PLACEHOLDER) { |tag| build_uid[].tap { |uid| pre_placeholders[uid] = tag } }
                  ^^^^^^^^^^^^^^^
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/lib/erb/formatter.rb:101:in `initialize'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/lib/erb/formatter/command_line.rb:101:in `new'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/lib/erb/formatter/command_line.rb:101:in `block in run'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/lib/erb/formatter/command_line.rb:97:in `each'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/lib/erb/formatter/command_line.rb:97:in `run'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/erb-formatter-0.7.3/exe/erb-format:5:in `<top (required)>'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/bin/erb-format:25:in `load'
	from /Users/jon/.local/share/mise/installs/ruby/3.3.4/bin/erb-format:25:in `<main>'

@elia elia force-pushed the feature/support-unicode-chars branch from 55edcf0 to 57761b5 Compare January 29, 2025 14:57
@elia
Copy link
Member

elia commented Jan 29, 2025

Hey, I tried to add a spec that would fail with utf8 chars, can you please share an example of a template that would fail?
I'll be happy to add it and merge.

@elia elia changed the title fix: allow unicode chars, force_encoding('UTF-8') llow unicode chars, force_encoding('UTF-8') Jan 29, 2025
@elia elia changed the title llow unicode chars, force_encoding('UTF-8') Allow unicode chars, force_encoding('UTF-8') Jan 29, 2025
@elia elia added the question Further information is requested label Jan 29, 2025
@jondkinney
Copy link
Contributor Author

These characters threw those errors:

The dash: more—effortlessly
The copyright: ©
The quote: Figma and Tailwind ” are used

@elia elia force-pushed the feature/support-unicode-chars branch from 170b4d3 to 3afad2a Compare March 20, 2025 12:01
@elia elia force-pushed the feature/support-unicode-chars branch from 3afad2a to 7a80fa8 Compare March 20, 2025 12:03
@elia
Copy link
Member

elia commented Mar 20, 2025

Hey @jondkinney thanks for the report, I was able to sort of reproduce the issue by setting LANG and LC_ALL to C and have ruby used ASCII as the default encoding. I added a few changes to the CI so it will always test in that scenario as well.
I think using UTF-8 for everything is reasonable, but I'm ready to roll it back to a warning if there are incompatible use cases.

@elia elia merged commit d32e3a9 into nebulab:main Mar 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants