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.compatible? affected by call order #2312

Closed
nirvdrum opened this issue Dec 12, 2014 · 0 comments
Closed

Encoding.compatible? affected by call order #2312

nirvdrum opened this issue Dec 12, 2014 · 0 comments

Comments

@nirvdrum
Copy link
Contributor

@nirvdrum nirvdrum commented Dec 12, 2014

EncodingService has two lookup tables. One takes an Encoding's index and returns a RubyEncoding. This table is lazily created. A single Encoding may be used by multiple RubyEncodings. One such case is with "GB2312" and "EUC-KR". Whichever gets loaded first will occupy the spot in the table and the other will resolve to that RubyEncoding.

Examples:

$ bin/jruby -e 'p Encoding.compatible?(Encoding.find("GB2312"), Encoding.find("EUC-KR")); p Encoding.compatible?(Encoding.find("EUC-KR"), Encoding.find("GB2312"))'
#<Encoding:EUC-KR>
#<Encoding:EUC-KR>
$ bin/jruby -e 'p Encoding.compatible?(Encoding.find("EUC-KR"), Encoding.find("GB2312")); p Encoding.compatible?(Encoding.find("GB2312"), Encoding.find("EUC-KR"))'
#<Encoding:GB2312>
#<Encoding:GB2312>

@enebo enebo added this to the 9.0.0.0.pre2 milestone Apr 28, 2015
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