[MacRuby] #1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Keywords: ----------------------------+----------------------------------------------- in an empty directory: {{{ touch rübe.txt; touch tomate.txt }}} files with Unicode-characters give false result: {{{ macruby -e 'p Dir["r*.txt"].first == "rübe.txt"' false }}} without Unicode chars everything is fine: {{{ macruby -e 'p Dir["t*.txt"].first == "tomate.txt"' true }}} All strings have the same encoding: #<Encoding:UTF-8> -- Ticket URL: <http://www.macruby.org/trac/ticket/1028> MacRuby <http://macruby.org/>
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Keywords: ----------------------------+----------------------------------------------- Comment(by jazzbox@…): the string seems to be corrupted: {{{ $ macruby -e 'p Dir["r*.txt"].first[0..2]' "rü" }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1028#comment:1> MacRuby <http://macruby.org/>
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Keywords: ----------------------------+----------------------------------------------- Old description:
in an empty directory:
{{{ touch rübe.txt; touch tomate.txt }}}
files with Unicode-characters give false result:
{{{ macruby -e 'p Dir["r*.txt"].first == "rübe.txt"' false }}}
without Unicode chars everything is fine:
{{{ macruby -e 'p Dir["t*.txt"].first == "tomate.txt"' true }}}
All strings have the same encoding: #<Encoding:UTF-8>
New description: in an empty directory: {{{ touch rübe.txt; touch tomate.txt }}} files with Unicode-characters give false result: {{{ macruby -e 'p Dir["r*.txt"].first == "rübe.txt"' false }}} without Unicode chars everything is fine: {{{ macruby -e 'p Dir["t*.txt"].first == "tomate.txt"' true }}} All strings have the same encoding: #<Encoding:UTF-8> -- Comment(by vincent.isambart@…): I'll have to check on my Mac when I get back home, but I suspect a problem of normalization (http://www.unicode.org/reports/tr15/). If I remember correctly, the Mac OS X file system is know to use form D (Canonical Decomposition) whereas most editors use form C (Canonical Decomposition, followed by Canonical Composition). Something like: {{{ macruby -e 'p Dir["r*.txt"].first.precomposedStringWithCanonicalMapping == "rübe.txt".precomposedStringWithCanonicalMapping' }}} would probably work. Note that I'm pretty sure at some point Laurent did something to make some path strings automatically converted to form C but that seems to have disappeared when we rewrote String. -- Ticket URL: <http://www.macruby.org/trac/ticket/1028#comment:2> MacRuby <http://macruby.org/>
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Keywords: ----------------------------+----------------------------------------------- Comment(by jazzbox@…): You are right, this is working: {{{ $ macruby -e 'p Dir["r*.txt"].first.precomposedStringWithCanonicalMapping == "rübe.txt".precomposedStringWithCanonicalMapping' true }}} {{{ $ macruby -e 'p Dir["r*.txt"].first.precomposedStringWithCanonicalMapping == "rübe.txt"' true }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1028#comment:3> MacRuby <http://macruby.org/>
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------+----------------------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 0.8 => -- Ticket URL: <http://www.macruby.org/trac/ticket/1028#comment:4> MacRuby <http://macruby.org/>
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------+----------------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.8 Comment: Should be fixed in r4991. Note: only paths returned by Dir.glob are corrected. We will have to investigate all core APIs returning filesystem paths and make them use the new rstr_new_path() private function. -- Ticket URL: <http://www.macruby.org/trac/ticket/1028#comment:5> MacRuby <http://macruby.org/>
#1028: Strings generated by a directory listing of files with Unicode chars in name cannot be compared ----------------------------+----------------------------------------------- Reporter: jazzbox@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------+----------------------------------------------- Comment(by jazzbox@…): Thanks for fixing! The system call is also concerned by it: {{{ $ macruby -e 'p `ls r*`.chars.to_a' ["r", "u", "̈", "b", "e", ".", "t", "x", "t", "\n"] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1028#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby