Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with unicode_utils gem #22

Open
n-rodriguez opened this issue Oct 17, 2024 · 1 comment
Open

Issue with unicode_utils gem #22

n-rodriguez opened this issue Oct 17, 2024 · 1 comment
Labels

Comments

@n-rodriguez
Copy link

n-rodriguez commented Oct 17, 2024

Hi there!

strings depends on unicode_utils (https://github.com/piotrmurach/strings/blob/master/strings.gemspec#L27)

unicode_utils is not compatible with frozen_string_literal lang/unicode_utils#13 and don't seem to be maintained 😢

And so it breaks with :

/Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.3.0/gems/unicode_utils-1.4.0/lib/unicode_utils/read_cdata.rb:124:in `force_encoding': can't modify frozen String: "x", created at /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.3.0/gems/unicode_utils-1.4.0/lib/unicode_utils/read_cdata.rb:123 (FrozenError)

Because I've enabled frozen-string-literal globally in my Rails project :

export RUBYOPT="--enable=frozen-string-literal --debug=frozen-string-literal"

See: https://gist.github.com/fxn/bf4eed2505c76f4fca03ab48c43adc72

A solution would be to vendor/include what you need from unicode_utils :

https://github.com/piotrmurach/strings/blob/master/lib/strings/truncate.rb#L5
https://github.com/piotrmurach/strings/blob/master/lib/strings/wrap.rb#L5

https://github.com/lang/unicode_utils/blob/master/lib/unicode_utils/each_grapheme.rb
https://github.com/lang/unicode_utils/blob/master/lib/unicode_utils/read_cdata.rb

Thank you!

@n-rodriguez
Copy link
Author

ping @piotrmurach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant