Feature #1835

0x80.chr not equal to "\x80"

Added by phasis68 (Heesob Park) almost 3 years ago. Updated about 1 year ago.

[ruby-core:24603]
Status:Rejected Start date:07/30/2009
Priority:Normal Due date:
Assignee:naruse (Yui NARUSE) % Done:

0%

Category:M17N
Target version:1.9.1

Description

I suggest 0x80.chr should be equal to "\x80" regardless of locale.

Here is the current behavior:

irb(main):001:0> 0x80.chr.encoding
=> #<Encoding:ASCII-8BIT>
irb(main):002:0> "\x80".encoding
=> #<Encoding:UTF-8>
irb(main):003:0> 0x80.chr=="\80"
=> false
irb(main):004:0> h={}
=> {}
irb(main):005:0> h[0x80.chr]=1
=> 1
irb(main):006:0> h["\x80"]=2
=> 2
irb(main):007:0> h
=> {"\x80"=>1, "\x80"=>2}

History

Updated by naruse (Yui NARUSE) almost 3 years ago

  • Category changed from core to M17N
  • Status changed from Open to Assigned
  • Assignee set to naruse (Yui NARUSE)
Why you want it.  "\x80" has any special reason?

Updated by phasis68 (Heesob Park) almost 3 years ago

"0x80" is just an example.
It means the ASCII code in the range of 0x80-0xFF.

It is inconsistent with the case of 0x00-0x7F.

Updated by naruse (Yui NARUSE) almost 3 years ago

Ruby 1.9 treats 0x00-0x7F specially because 0x00-0x7F is compatible with many other encodings. (ASCII compatible encosings)
But 0x80-0xFF doesn't.

Updated by naruse (Yui NARUSE) almost 3 years ago

  • Status changed from Assigned to Rejected

Also available in: Atom PDF