H
Horacio Sanson
I am having some issues with regular expressions when working with japanese=
=20
strings.
Using ruby-1.8.3 on Windows XP home (Japanese version) I have this test:
irb(main):271:0> s =3D "=E9=9E=84"
=3D> "\212\223"
irb(main):272:0> l =3D "=E8=A1=8C"
=3D> "\215s"
irb(main):273:0> l =3D~ /s/
=3D> 1
irb(main):274:0> puts "#{$`}<<#{$&}>>#{$'}"
E<s>>
=3D> nil
irb(main):275:0> "#{$`}<<#{$&}>>#{$'}"
=3D> "\215<<s>>"
irb(main):276:0> s =3D~ /l/
=3D> nil
As you can see comparing two totally different characters (kanji) gives me =
a=20
match. Reversing the match gives nil.
How can I get ruby to match things correctly??=20
regards,
Horacio
=20
=20
strings.
Using ruby-1.8.3 on Windows XP home (Japanese version) I have this test:
irb(main):271:0> s =3D "=E9=9E=84"
=3D> "\212\223"
irb(main):272:0> l =3D "=E8=A1=8C"
=3D> "\215s"
irb(main):273:0> l =3D~ /s/
=3D> 1
irb(main):274:0> puts "#{$`}<<#{$&}>>#{$'}"
E<s>>
=3D> nil
irb(main):275:0> "#{$`}<<#{$&}>>#{$'}"
=3D> "\215<<s>>"
irb(main):276:0> s =3D~ /l/
=3D> nil
As you can see comparing two totally different characters (kanji) gives me =
a=20
match. Reversing the match gives nil.
How can I get ruby to match things correctly??=20
regards,
Horacio
=20