[MacRuby] #700: Escaped Unicode chars in hex are not recogized
#700: Escaped Unicode chars in hex are not recogized ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: unicode ----------------------------+----------------------------------------------- {{{ $ macruby_select 0.7 -e 'p "R\xfcbe"' "R\xFCbe" }}} 0.5 does it correct: {{{ $ macruby_select 0.5 -e 'p "R\xfcbe"' "Rübe" }}} hex ASCII works: {{{ $ macruby_select 0.7 -e 'p "R\x61be"' "Rabe" }}} and Unicode code point works too: {{{ macruby_select 0.7 -e 'p "R\u00fcbe"' "Rübe" }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/700> MacRuby <http://macruby.org/>
#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/>
#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 | ----------------------------+----------------------------------------------- Comment(by jazzbox@…): Hi, I didn't rely on Ruby 1.9 because of this: {{{ $ ruby1.9 -e 'require "yaml"; puts "Rübe".to_yaml' --- "R\xC3\xBCbe" }}} If you look at Ticket #339 you will see, that neeracher told me that Ruby 1.9 is completely wrong in this case. Now I am confused a little bit. If you are right, the following is definitely wrong! (with MacRuby 0.7 nightly-latest): {{{ $ macruby -r 'yaml' -e 'puts "Rübe".to_yaml' --- "R\xFCbe" }}} That's the way I came to the "R\xFCbe"! I then tried to repair this wrong YAML with an eval: {{{ $ macruby -r 'yaml' -e 'puts "Rübe".to_yaml.gsub(/"([ a-zA-Z0-9\\]*)"/) { |m| eval(m) }' --- R?be }}} while Ruby 1.9 seems to be OK here: {{{ $ ruby1.9 -r 'yaml' -e 'puts "Rübe".to_yaml.gsub(/"([ a-zA-Z0-9\\]*)"/) { |m| eval(m) }' --- Rübe }}} I think, ticket #339 should be reopened! What do you think? -- Ticket URL: <http://www.macruby.org/trac/ticket/700#comment:2> MacRuby <http://macruby.org/>
#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 | ----------------------------+----------------------------------------------- Comment(by vincent.isambart@…): I don't know YAML well, but I think it just means that \x in YAML and \x in MacRuby have a different meaning. -- Ticket URL: <http://www.macruby.org/trac/ticket/700#comment:3> MacRuby <http://macruby.org/>
#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 | ----------------------------+----------------------------------------------- Comment(by jazzbox@…): I must admit, that I don't really understand the YAML specs [http://www.yaml.org/spec/1.2/spec.html#id2776092], but I think that MacRuby should have the same behaviour like Ruby 1.9: {{{ $ ruby1.9 -e 'require "yaml"; puts "Rübe".to_yaml' --- "R\xC3\xBCbe" }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/700#comment:4> MacRuby <http://macruby.org/>
#700: YAML: Escaped Unicode chars in hex are not recogized ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: reopened Priority: major | Milestone: Component: MacRuby | Resolution: Keywords: unicode | ----------------------------+----------------------------------------------- Changes (by lsansonetti@…): * status: closed => reopened * milestone: MacRuby 0.7 => * resolution: invalid => Comment: {{{ $ /usr/local/bin/macruby -e 'require "yaml"; puts "Rübe".to_yaml' --- "R\xFCbe" }}} Agreed, it does not seem to behave the same. But this sounds like a bug in the YAML extension, not in the core strings. -- Ticket URL: <http://www.macruby.org/trac/ticket/700#comment:5> MacRuby <http://macruby.org/>
#700: Escaped Unicode chars in hex are not recogized ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: invalid Keywords: unicode | ----------------------------+----------------------------------------------- Changes (by lsansonetti@…): * status: reopened => closed * resolution: => invalid Comment: I read the replies too fast, sorry, didn't see the reference to #339. The discussion should continue in #339 I guess. -- Ticket URL: <http://www.macruby.org/trac/ticket/700#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby