From: "Stephan Kämper" Date: 2004-04-01T23:19:25+09:00 Subject: Re: how to match acented letters on windows Hi Gabriele, gabriele renzi wrote: > Hi gurus and nubys, > > I just noticed that accented letters like ������ (actually, if someone > can see them correctly in this message, either) > are not matched by /[a-z]/ or \w on windows. > >irb irb(main):001:0> a = "Wrongly �cc�nt�d" => "Wrongly \240cc\212nt\210d" irb(main):002:0> a =~ /�/ => nil irb(main):003:0> a =~ /�/ => 11 irb(main):004:0> a =~ /�/ => 14 irb(main):005:0> They are matched, but they're not part of [a-z] apparently. What I think is, [a-z] is somehow mapped to the ASCII (or whatever) code. Anyway irb(main):002:0> a =~ /[�-�]/ => 14 irb(main):003:0> (Running a 1.8.0 on WinXP) BTW, you could as well write "y��r str�ng g��s h�r�" =~ /[\224-\239]/ Using that you'll get at least the vocals (I know of). Note that there are a whole lot of accented letters: Check your character table, somewhere in Start|Programs|Utilities|System... I translated from my German menu entries, so YMMV a bit. > I've not tryed on *nix with proper locale set, but I wonder if, > anyway, there is something special I should do to allow this kind of > special letters to be matched as letters. > > (running pragprog ruby 1.8.1 on win xp) Now, that leads me to a question: _Should_ accented letters be matched by [a-z]? I personally am not sure whether it does... Happy rubying Stephan