Issue #6258 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Feedback to Closed

This was fixed between 2.0 and 2.1:

```
$ ruby20 -e 'p "\u1036".succ' 
"\u1000\u1000"
$ ruby21 -e 'p "\u1036".succ' 
"\u1038"
```

----------------------------------------
Bug #6258: String#succ has suprising behavior for "\u1036" (MYANMAR SIGN ANUSVARA), producing "\u1000" instead of "\u1037"
https://bugs.ruby-lang.org/issues/6258#change-79422

* Author: dbenhur (Devin Ben-Hur)
* Status: Closed
* Priority: Normal
* Assignee: duerst (Martin Drst)
* Target version: 
* ruby -v: ruby 1.9.3p125, ruby 1.9.2p180,
* Backport: 
----------------------------------------
"\u1036".succ.ord.to_s(16) # => "1000"

Discovered when investigating StackOverflow question http://stackoverflow.com/questions/10020230/anomalous-behavior-while-comparing-a-unicode-character-to-a-unicode-character-range

Range#=== ultimately invokes String#upto which uses String#succ

("\u1036".."\u1037").to_a.map{|c| c.ord.to_s(16)}
=> ["1036"]  # expected ["1036","1037"]

Also once #succ! proceeds past U+1036 it continues to produce U+1000 indefinitely

irb(main):115:0> c = "\u1036"
=> ""
irb(main):116:0> c.ord.to_s(16)
=> "1035"
irb(main):117:0> c.succ!.ord.to_s(16)
=> "1036"
irb(main):118:0> c.succ!.ord.to_s(16)
=> "1000"
irb(main):119:0> c.succ!.ord.to_s(16)
=> "1000"

But if one starts naturally at U+1000 #succ! increments as expected
irb(main):001:0> c = "\u1000"
=> ""
irb(main):002:0> c.ord.to_s(16)
=> "1000"
irb(main):003:0> c.succ!.ord.to_s(16)
=> "1001"
irb(main):004:0> c.succ!.ord.to_s(16)
=> "1002"




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>