[MacRuby] #1295: A bug in NSMutableString#sub! with non ASCII chars
MacRuby
ruby-noreply at macosforge.org
Sat May 21 06:34:31 PDT 2011
#1295: A bug in NSMutableString#sub! with non ASCII chars
----------------------------------+-----------------------------------------
Reporter: yasuimao@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
A bug with NSMutableString#sub!. Characters are corrupted when replaced
with non-ASCII characters. This does not happen with 'gsub!' nor
'sub/gsub'. And as pointed out by Vincent, this also happens with
'self[]'.
Here's the code written by Vincent.
{{{
framework 'Cocoa'
s1 = NSMutableString.stringWithString("this is a test script.")
s1.sub!(/test/, "あ")
puts s1 #=> this is a  ̄チツ script.
s2 = NSMutableString.stringWithString("this is a test script.")
s2[10..14] = "あ"
puts s2 #=> this is a  ̄チツ script.
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/1295>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list