Project

General

Profile

Actions

Bug #8775

closed

Dir.getwd's encoding is wrong

Added by jiayp@glodon.com (贾 延平) over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Assignee:
Target version:
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 .


Files

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

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0