[macruby] #94: Bug with non-ASCII in the regular expressions
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- The following code source displays correctly "あ" in both 1.9 and 1.8 but it wrongly displays "" in MacRuby. I think the reason is that the regexps created with Oniguruma are always created with an ASCII encoding in MacRuby (shouldn't it be UTF-8 as all source code files are handled as UTF-8?). # encoding: utf-8 version = RUBY_VERSION.sub(/(\d+\.\d+)\.\d+/, '\1').to_f $KCODE = 'u' if version <= 1.8 # remove the warning we get in 1.9 for using $KCODE m = /あ/.match('あ') p m[0] -- Ticket URL: <https://www.macruby.org/trac/ticket/94> macruby <http://macruby.org/>
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Resolution: Keywords: | ----------------------------------------+----------------------------------- Comment (by vincent.isambart@gmail.com): I forgot to put the code in a code block, so here it is once again. (I also removed the version test as it only makes it less readable) {{{ # encoding: utf-8 $KCODE = 'u' # for Ruby 1.8 m = /あ/.match('あ') p m[0] }}} -- Ticket URL: <https://www.macruby.org/trac/ticket/94#comment:1> macruby <http://macruby.org/>
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.3 Component: MacRuby | Resolution: Keywords: | ----------------------------------------+----------------------------------- Changes (by lsansonetti@apple.com): * milestone: => MacRuby 0.3 -- Ticket URL: <http://www.macruby.org/trac/ticket/94#comment:2> macruby <http://macruby.org/>
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: Keywords: | ----------------------------------------+----------------------------------- Changes (by lsansonetti@apple.com): * milestone: MacRuby 0.3 => MacRuby 0.4 -- Ticket URL: <http://www.macruby.org/trac/ticket/94#comment:3> MacRuby <http://macruby.org/>
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Comment(by hiroshi3110@…): This doesn't seem to resolved even in MacRuby 0.5 (trunk r82747). -- Ticket URL: <http://www.macruby.org/trac/ticket/94#comment:4> MacRuby <http://macruby.org/>
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: ----------------------------------------+----------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 0.4 => MacRuby 0.5 -- Ticket URL: <http://www.macruby.org/trac/ticket/94#comment:5> MacRuby <http://macruby.org/>
#94: Bug with non-ASCII in the regular expressions ----------------------------------------+----------------------------------- Reporter: vincent.isambart@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------------+----------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed Comment: Fixed in r3189. {{{ $ cat t.rb # encoding: utf-8 p 'あ'.match(/あ/) p 'あいあいあいあいあ'.scan(/あ/) $ ./miniruby t.rb #<MatchData "あ"> ["あ", "あ", "あ", "あ", "あ"] }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/94#comment:6> MacRuby <http://macruby.org/>
participants (2)
-
macruby
-
MacRuby