From: Jimmy Kofler Date: 2007-09-22T20:04:19+09:00 Subject: Re: Unicode > Michal Suchanek wrote: > On 15/09/2007, Zephyr Pellerin wrote: >> I hate to discuss something related to the development timeline, I know >> its tenable, but When will it be reasonable to expect Unicode support >> from Ruby? > > Ruby has unicode support. Sort of. Regexes work in UTF-8 when $KCODE > is set to "U" (and the default is "N" even in UTF-8 locales, and if > you specify the -K option in the .rb file it overrides the option > specified on the command line, heh). > The non-regex methods do not work but you can convert the string with > str.scan(/./)[0] or str.unpack "U*", and use stuff like each, reverse, > [], ... > You have to remember to convert the string back, though. > > Thanks > > Michal ... or you may use the /re/u regex option to handle UTF-8 encoded strings (cf. http://snippets.dzone.com/posts/show/4527 ). Cheers, j.k. -- Posted via http://www.ruby-forum.com/.