What determines the encoding of File#path?
In ruby 1.8.7, what determines what the encoding of File#path
will be? The filesystem? A configuration somewhere? The encoding of each individual file?
I've seen two different encodings in otherwise identical environments on different OS's.
Related question: Reading filename in multiple OS without encodin开发者_如何学JAVAg problem with Ruby
update
I guess I need to set/know the encoding of the filesystem... this does not help though (unless I'm putting it in the wrong place)...
export LC_ALL=en_US.UTF-8 export LC_CTYPE=en_US.UTF-8
Theoratically you can read the system's encoding from
ENV['LC_LANG']
and you can set it the same way for the ruby script:
ENV['LC_LANG']=en_US.UTF-8
Same goes for the other encoding specific environment variables.
精彩评论