[MacRuby-devel] [MacRuby] #192: String#length and String#size do not work correctly

MacRuby ruby-noreply at macosforge.org
Fri Dec 26 15:50:35 PST 2008


#192: String#length and String#size do not work correctly
----------------------------------------+-----------------------------------
 Reporter:  vincent.isambart@…          |       Owner:  lsansonetti@…        
     Type:  defect                      |      Status:  new                  
 Priority:  critical                    |   Milestone:                       
Component:  MacRuby                     |    Keywords:                       
----------------------------------------+-----------------------------------
 String#length and String#size return the byte size instead of the number
 of characters in the string.
 {{{
 # coding: utf-8
 p 'あ'.length
 p 'あ'.size
 p 'あ'.bytesize
 }}}

 Ruby 1.9:
 {{{
 1
 1
 3
 }}}

 MacRuby:
 {{{
 3
 3
 3
 }}}

 For #size, the function is declared normally in string.c but for #length,
 you have to remove it from opt_length in insns.def.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/192>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list