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

Encoding issue with interned symbols #7627

Closed
ahorek opened this issue Feb 6, 2023 · 0 comments
Closed

Encoding issue with interned symbols #7627

ahorek opened this issue Feb 6, 2023 · 0 comments
Milestone

Comments

@ahorek
Copy link
Contributor

ahorek commented Feb 6, 2023

Environment Information
jruby 9.4.1.0-SNAPSHOT (3.1.0) 2023-02-04 ec0164c Java HotSpot(TM) 64-Bit Server VM 15.0.2+7-27 on 15.0.2+7-27 +jit [x86_64-linux]

originally reported msgpack/msgpack-ruby#248 and my (incorrect) attempt for a workaround #7618

Expected Behavior

source = "fée"
iso_symbol = source.force_encoding(Encoding::ISO_8859_1).to_sym
p iso_symbol.encoding # => Encoding::ISO_8859_1
p iso_symbol.object_id # => 60
binary_symbol = source.force_encoding(Encoding::BINARY).to_sym
p binary_symbol.encoding # => Encoding:ASCII-8BIT
p binary_symbol.object_id # => 80

Actual Behavior

source = "fée"
iso_symbol = source.force_encoding(Encoding::ISO_8859_1).to_sym
p iso_symbol.encoding # => Encoding::ISO_8859_1
p iso_symbol.object_id # => 4000
binary_symbol = source.force_encoding(Encoding::BINARY).to_sym
p binary_symbol.encoding # => Encoding:ISO-8859-1
p binary_symbol.object_id # => 4000

non-ascii symbols with the same byte representation are shared even if the encoding is different.

@ahorek ahorek closed this as completed Feb 6, 2023
@enebo enebo added this to the Won't Fix milestone Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants