You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jruby -J-Dfile.encoding=utf-8 test_jp.rb
Encoding::CompatibilityError: incompatible character encodings: Windows-31J and UTF-8
rindex at org/jruby/RubyString.java:3423
chop_basename at C:/jruby-1.7.17/lib/ruby/1.9/pathname.rb:48
cleanpath_aggressive at C:/jruby-1.7.17/lib/ruby/1.9/pathname.rb:101
cleanpath at C:/jruby-1.7.17/lib/ruby/1.9/pathname.rb:89
(root) at test_jp.rb:8
I think it's due to changing encoding in Path#expand_path.
Path#expand_path changes encoding on windows.
I tested the code below.
# coding: utf-8
require 'pathname'
str = './ディレクトリ0'
path = Pathname.new(str)
p path.to_s.encoding
abs = path.expand_path
p abs.to_s.encoding
I think it's related with this line.
In the line, the encoding is forced into default external.
But in other similar methods(e.g. File.absolute_path), encoding is not forced to be changed.
I'm using jruby 1.7.17 on windows 7.
I ran this code.
And I got a error about encoding in Pathname#cleanpath with multi-byte(utf-8) string.
I think it's due to changing encoding in Path#expand_path.
Path#expand_path changes encoding on windows.
I tested the code below.
And I got this result.
Is it expected behavior?
The text was updated successfully, but these errors were encountered: