From: Michal Suchanek Date: 2006-03-08T21:44:52+09:00 Subject: Re: unicode in ruby On 3/8/06, Richard Gyger wrote:> i'm using IO.foreach to parse the lines in a file. now i'm trying to get> it to work with unicode encoded files. does ruby support unicode? how do> i compare a variable with a unicode constant string?>> the script goes something like:>> IO.foreach("myfile.txt") { |line|> if line.downcase[0,2] == "id" To get unicode downcase you probably want icu4r. To handle the casesyou are interested in you could write your own. However, the []operator of ruby strings returns bytes, not characters. hth Michal -- Support the freedom of music!Maybe it's a weird genre .. but weird is *not* illegal.Maybe next time they will send a special forces commandoto your picnic .. because they think you are weird. www.music-versus-guns.org http://en.policejnistat.cz