Bug #8775
closedDir.getwd's encoding is wrong
Description
See the patch.
I do't know is this the right way,please check it .
Files
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
- Status changed from Open to Rejected
That's filesystem encoding.
ospath is to interface with the system.
Updated by jiayp@glodon.com (贾 延平) over 11 years ago
Maybe my solution is wrong.
But Dir.getwd should encoded into internel encoding,am I right?
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
It's not.
Path name is not the target of automagical conversion.
Updated by jiayp@glodon.com (贾 延平) over 11 years ago
You mean the code
File.getwd+'some utf-8 file name'
Should raise encoding compitable error?
Where I can see the ruby's internal design principle for encoding?When encode to internal encoding?When do not?
The doc:http://www.ruby-doc.org/core-2.0/Encoding.html say some thing but do not tell why.
Updated by nobu (Nobuyoshi Nakada) over 11 years ago
If the filesystem encoding is not UTF-8.
From when did you think it is always UTF-8?
Updated by jiayp@glodon.com (贾 延平) over 11 years ago
Maybe I did not speake clearly,When we write ruby code,we should consider the string create is internal encoding by default,and if internal encoding != filesystem encoding when we use the File.getwd result with other strings that will be problem.