-
-
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
File.expand_path doesn't respect args encoding #3849
Comments
Running this on any Gemfile produces the same result? It does appear that we're continuing to encode paths from the system as the system's encoding. If you can narrow this down to something specific in We also need to know what the default encoding/locale/character page is for your Windows system. |
Running this on any Gemfile produces the same result? yes I've found the cause jruby irb(main):012:0> File.expand_path('/').encoding
=> #<Encoding:IBM852>
irb(main):013:0> File.expand_path('/'.force_encoding('UTF-8')).encoding
=> #<Encoding:IBM852>
irb(main):014:0> mri irb(main):007:0> File.expand_path('/').encoding
=> #<Encoding:IBM852>
irb(main):008:0> File.expand_path('/'.force_encoding('UTF-8')).encoding
=> #<Encoding:UTF-8> related code https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/RubyFile.java#L786 @JRubyMethod(name = "expand_path", required = 1, optional = 1, meta = true)
public static IRubyObject expand_path19(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
RubyString path = (RubyString) expandPathInternal(context, recv, args, true, false);
path.force_encoding(context, context.runtime.getEncodingService().getDefaultExternal());
return path;
} |
Thanks to @ahorek we have merged fixes and tests to master that should at least incrementally improve our expand_path encoding logic. Please file any remaining incompatibilities as new issues. |
Environment
jruby -v
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]
also doesn't work with jruby 9.0.5.0
java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
Expected Behavior
Path should be encoded in UTF8
Actual Behavior
The text was updated successfully, but these errors were encountered: