Project

General

Profile

Bug #8775

Dir.getwd's encoding is wrong

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

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

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 [ruby-core:56549] Updated by Nobuyoshi Nakada over 2 years ago

  • Status changed from Open to Rejected

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

#2 [ruby-core:56561] Updated by 贾 延平 over 2 years ago

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

#3 [ruby-core:56565] Updated by Nobuyoshi Nakada over 2 years ago

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

#4 [ruby-core:56568] Updated by 贾 延平 over 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 [ruby-core:56587] Updated by Nobuyoshi Nakada over 2 years ago

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

#6 [ruby-core:56589] Updated by 贾 延平 over 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