Bug #8774

rb_file_dirname return wrong encoding string when dir is "."

Added by 贾 延平 8 months ago. Updated 3 months ago.

[ruby-core:56544]
Status:Open
Priority:Normal
Assignee:-
Category:core
Target version:current: 2.2.0
ruby -v:ruby 2.1.0dev (2013-08-10 trunk 42491) [i386-mingw32] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

When File.dirname()'s value is ".", the value is wrong encoded.

rb_get_dirname.patch Magnifier (423 Bytes) 贾 延平, 08/11/2013 03:28 PM


Related issues

Related to ruby-trunk - Bug #8789: File.expand_path(File.dirname(__FILE__)) return wrong enc... Assigned 08/16/2013

History

#1 Updated by Nobuyoshi Nakada 8 months ago

  • Status changed from Open to Feedback

"." is 7bit only, it has no differences.

Why do you consider it wrong?

#2 Updated by 贾 延平 8 months ago

The rbfiledirname should not return diffrent encoding string value just because the string's content diffrent.
And some other function like rbfileexpand_path will return the value with the input paramter's incoding,and the result is not 7bit string.

#3 Updated by 贾 延平 8 months ago

I did not write clear,the ".' having the encoding ascii-8bit not ascii-7bit,so it will be some problem.

Why ruby's default encoding is ascii-8bit not ascii-7bit,will we need the 8bit in there some condition?

#4 Updated by Nobuyoshi Nakada 8 months ago

rbusasciistr_new2() makes a string in US-ASCII, which is 7bit.

#5 Updated by Nobuyoshi Nakada 8 months ago

  • Status changed from Feedback to Rejected

#6 Updated by 贾 延平 8 months ago

Yes,you are right,maybe my problem couse by the other reason.

#7 Updated by Usaku NAKAMURA 8 months ago

  • Status changed from Rejected to Open

(reopened. the reason is written at #8789)

#8 Updated by 贾 延平 7 months ago

Any progress?

#9 Updated by Hiroshi SHIBATA 3 months ago

  • Target version changed from 2.1.0 to current: 2.2.0

Also available in: Atom PDF