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

Use "filesystem" encoding for PATH as in MRI. Fixes #3907. #3923

wants to merge 6 commits into from


Copy link

@headius headius commented May 25, 2016

See #3907.

@headius headius added this to the JRuby milestone May 25, 2016
@@ -111,17 +111,22 @@
val = entry.getValue();
if ( ! (val instanceof String) ) continue; // Java devs can stuff non-string objects into env

putRubyKeyValuePair(runtime, rubyMap, key, (String) val, encoding);
Encoding valueEncoding = keyEncoding;
if ( key.equals("PATH") ) {

This comment has been minimized.


ahorek May 25, 2016

if ( key.equalsIgnoreCase("PATH") ) {

This comment has been minimized.


headius May 25, 2016
Author Member

Mmm, I suppose this would be in line with environment vars being case-insensitive on Windows, wouldn't it.

Copy link
Member Author

@headius headius commented May 25, 2016

The failure was valid; my changes were a bit overreaching in trying to get encodings right. I've reverted the modified behavior for "locale" encoding and everything is green again.

headius added 6 commits May 25, 2016
This fixes the one regression in my previous changes. Because MRI
always creates new strings when you read from ENV, they just
normalize to locale encoding for setenv, and then either use
locale encoding or filesystem encoding for getenv. The equivalent
for us here is to just let the setenv string decode to Java String
and then use the default getBytes to match it up with the default
Charset used for locale, rather than attempting to transcode the
string directly.
@headius headius force-pushed the headius:filesystem_encoding_for_path branch from 46bce29 to 9d7295d May 25, 2016
Copy link
Member Author

@headius headius commented May 25, 2016

Merged to master in 221ba4f. Merging to branch now.

@headius headius closed this May 25, 2016
@headius headius deleted the headius:filesystem_encoding_for_path branch May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.