[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: UTF-8 character downcase!!

Victor 'Zverok' Shepelev

9/2/2007 1:38:00 PM

From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf Of
Igor K.
Sent: Sunday, September 02, 2007 12:09 PM
>
>>> I have a word = "??????", it's in russian, and i want to downcase this
>>> word(=??????). But standart method downcase not works with non-english
>>> letters
>>>
>>> Thank you for reply
>>> Reply with quote
>>
>>
>> Did you try using the character-encodings gem?
>>
>> http://rubyforge.org/projects/char-...
>>
>> http://snippets.dzone.com/posts...
>
>Thank you for reply
>
>But i can't install this plugin on Windows(the problem i think with
>command 'make', it's missing on Windows XP, so i can't compile source)
>
>Who knows solution for this problem?
>

Install Visual C++ (Express version is free). Then 'nmake'.

V.


1 Answer

Jimmy Kofler

9/2/2007 9:38:00 PM

0

> Re: UTF-8 character downcase!!
> Posted by Igor K. (demoversion) on 02.09.2007 11:08
>
> But i can't install this plugin on Windows(the problem i think with
> command 'make', it's missing on Windows XP, so i can't compile source)
>


As already indicated above, you may also consider to roll your own
utf8-aware downcase method.

class String

def downcase_utf8

gsub(/./mu) do |char|

case char
when /\320\237/u then "\320\277"
when /\320\240/u then "\321\200"
when /\320\230/u then "\320\270"
when /\320\222/u then "\320\262"
when /\320\225/u then "\320\265"
when /\320\242/u then "\321\202"
else
char
end

end # gsub
end
end


Cheers,

J.K.




--
Posted via http://www.ruby-....