Bug #3747: Possible bug of String#count?
http://redmine.ruby-lang.org/issues/show/3747

Author: Ruohao Li
Status: Open, Priority: Low
Category: M17N, Target version: 1.9.1
ruby -v: ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-darwin9]

$ ruby -v
ruby 1.9.1p429 (2010-07-02 revision 28523) [i386-darwin9]
$ cat c.rb
# -*- coding: utf-8 -*-

s = "a\u3042" # \u3042 is the japanese hiragana "a"
puts s.encoding.name
puts s.count("^a")
$ ruby c.rb
UTF-8
0

The result of count method should be 1 but is 0.


----------------------------------------
http://redmine.ruby-lang.org