[MacRuby-devel] [MacRuby] #700: Escaped Unicode chars in hex are not recogized
MacRuby
ruby-noreply at macosforge.org
Mon May 10 19:29:21 PDT 2010
#700: Escaped Unicode chars in hex are not recogized
----------------------------+-----------------------------------------------
Reporter: jazzbox@… | Owner: lsansonetti@…
Type: defect | Status: closed
Priority: major | Milestone: MacRuby 0.7
Component: MacRuby | Resolution: invalid
Keywords: unicode |
----------------------------+-----------------------------------------------
Changes (by vincent.isambart@…):
* status: new => closed
* resolution: => invalid
Comment:
Internationalization support was added in MacRuby 0.6. The previous
version did not have a proper support for it.
To see if something is really a bug you should first check with Ruby 1.9:
{{{
% ruby1.9 -e 'p "R\xFCbe"'
"R\xFCbe"
}}}
\x is to specify bytes, not code points (that's what \u is for). In fact
"R\xFCbe" would be "Rübe" in ISO-8859-1 (Latin-1), but MacRuby's default
encoding is UTF-8 (like Ruby 1.9). And I would not recommend working in
ISO-8859-1.
{{{
% macruby -e 'p "R\xFCbe".force_encoding("ISO-8859-1").encode("UTF-8")'
"Rübe"
}}}
(note that String#encode was added this week-end in trunk so it will not
work if you compiled your MacRuby before)
In UTF-8, "ü" takes 2 bytes so if you want to write "Rübe" using \x you
have to do: "R\xC3\xBCbe"
--
Ticket URL: <http://www.macruby.org/trac/ticket/700#comment:1>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list