From: 7stud -- Date: 2011-03-02T05:42:50+09:00 Subject: Re: Pattern matching French accented characters 7stud -- wrote in post #984785: > If you are not familiar with unicode, and you want to match utf-8 > characters, then you better start reading some unicode tutorials. If > you are already familiar with unicode in general, then in ruby you can > set the $KCODE variable to 'U' for UTF-8, and then you can require the > jcode standard library, which will change the way regexes work--they > will match characters rather than single bytes. > Uhhmm...you don't need to require 'jcode' to make regexes match characters rather than bytes--just set $KCODE = 'U' (or 'UTF-8'). The jcode library just gives you some methods like jsize to get the character length rather than the byte length, which is what String#size returns. As an alternative, you can set the /u flag for a regex to make it match characters rather than bytes. -- Posted via http://www.ruby-forum.com/.