Bug #8775

Dir.getwd's encoding is wrong

Added by 贾 延平 about 2 years ago. Updated about 2 years ago.

[ruby-core:56545]
Status:Rejected
Priority:Normal
Assignee:cruby-windows
ruby -v:ruby 2.1.0dev (2013-08-10 trunk 42491) [i386-mingw32] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

See the patch.
I do't know is this the right way,please check it .

dir.getwd.patch Magnifier (350 Bytes) 贾 延平, 08/11/2013 03:33 PM

History

#1 Updated by Nobuyoshi Nakada about 2 years ago

  • Status changed from Open to Rejected

That's filesystem encoding.
ospath is to interface with the system.

#2 Updated by 贾 延平 about 2 years ago

Maybe my solution is wrong.
But Dir.getwd should encoded into internel encoding,am I right?

#3 Updated by Nobuyoshi Nakada about 2 years ago

It's not.
Path name is not the target of automagical conversion.

#4 Updated by 贾 延平 about 2 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.

#5 Updated by Nobuyoshi Nakada about 2 years ago

If the filesystem encoding is not UTF-8.
From when did you think it is always UTF-8?

#6 Updated by 贾 延平 about 2 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.

Also available in: Atom PDF