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

JRuby not using UTF-8 for source files #2847

Closed
nirvdrum opened this issue Apr 17, 2015 · 4 comments
Closed

JRuby not using UTF-8 for source files #2847

nirvdrum opened this issue Apr 17, 2015 · 4 comments

Comments

@nirvdrum
Copy link
Contributor

@nirvdrum nirvdrum commented Apr 17, 2015

MRI seems to always use UTF-8 by default when loading source files. This is used by the lexer & parser, but doesn't update the runtime's encoding. JRuby, on the other hand, seems to always use whatever the default_external encoding is, which is influenced by the system's locale.

$ cat enc.rb
p Encoding.default_external
p __ENCODING__

$ LC_ALL=C bin/jruby -v enc.rb 
jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-04-17 7b6475d Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
#<Encoding:US-ASCII>
#<Encoding:US-ASCII>

$ LC_ALL=C ruby -v enc.rb 
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
#<Encoding:US-ASCII>
#<Encoding:UTF-8>
@nirvdrum nirvdrum closed this in fa541f4 Apr 22, 2015
@enebo enebo added this to the 9.0.0.0.pre2 milestone Apr 28, 2015
@enebo enebo added the parser label Apr 28, 2015
@guyboertje
Copy link

@guyboertje guyboertje commented Aug 4, 2015

@enebo or @headius - any plans to get this fix in 1.7.X?

@nirvdrum
Copy link
Contributor Author

@nirvdrum nirvdrum commented Aug 4, 2015

@guyboertje Which language mode are you running 1.7.x in?

@guyboertje
Copy link

@guyboertje guyboertje commented Aug 5, 2015

@nirvdrum - 1.9

@guyboertje
Copy link

@guyboertje guyboertje commented Aug 5, 2015

@nirvdrum - I guess I answered my own question. doh!

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

Successfully merging a pull request may close this issue.

None yet
3 participants