-
-
Notifications
You must be signed in to change notification settings - Fork 925
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.find("filesystem") on windows #3871
Comments
We can probably bind these few methods, but we don't have a compile time for it (and I expect @ahorek Does the output of |
irb(main):034:0> ENV_JAVA['file.encoding']
=> "Cp1252" or irb(main):033:0> java.nio.charset.Charset.defaultCharset.to_s
=> "windows-1252" private static Charset getDefaultCharset() {
String encoding = System.getProperty("file.encoding", "UTF-8");
try {
return Charset.forName(encoding);
} catch (UnsupportedCharsetException e) {
return Charset.forName("UTF-8");
}
} it matches, but I don't know how safe that is. |
Does it match what MRI reports? |
yes irb(main):007:0> Encoding.find("filesystem")
=> #<Encoding:Windows-1252> |
@ahorek Seems like a quick fix then would be for us to use the default charset or file.encoding for the filesystem encoding on Windows. |
@ahorek I have committed a change to try to use the value set for Could you please add a spec for this to https://github.com/ruby/spec, or otherwise a spec for our regression suite under spec/regression? |
Environment
jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [mswin32-x86_64]
Expected Behavior
mri
Actual Behavior
jruby
it looks like Encoding.find("filesystem") is just an alias to Encoding.default_external
https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/runtime/encoding/EncodingService.java#L545
for windows the mri's logic is a little bit different
The text was updated successfully, but these errors were encountered: