Discussion:
[jruby-user] File.expand_path changes encoding?
Roger Pack
2014-06-13 05:19:13 UTC
Permalink
a = "C:\\Users\\packrd\\Desktop\\Die drei Br\u00FCder/9.mp4"
=> "C:\\Users\\packrd\\Desktop\\Die drei Br\u00FCder/9.mp4"
a.encoding
=> #<Encoding:UTF-8>
File.expand_path(a)
=> "C:/Users/packrd/Desktop/Die drei Br\xFCder/9.mp4"
File.expand_path(a).encoding
=> #<Encoding:IBM437>

However, in MRI [at least 1.9.3 anyway] it preserves the initial
encoding of UTF-8. Bug presumably? [I think so, since after converting
encodings I can no longer refer to the filename by that path it's like
it doesn't actually exist...]
--
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...