[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: unicode in ruby

Nuralanur

3/8/2006 7:24:00 PM

Dear Michal,

hmm.
I have written the most complex Czech text file I could think of containing
the words Cesky and cesky - with hooks, that is, and saved it in UTF8
encoding as file utf8.txt.
Now, having installed Library No. 8 from _http://www.yoshidam.net/...
(http://www.yoshidam.net...) ,
the following script

-------------------------------------------------------------------

#!/c/axelhome/ruby -Ku -rjcode
require "unicode"

text=IO.readlines("/c/axelhome/ruby/utf8.txt")
p 'mytext'
p text
c=text.to_s.split
p c
d=Unicode::downcase(c[0])
e=Unicode::downcase(c[1])
puts "are the first letters equal ? #{d==e}"
------------------------------------------------------------------

returns true.

Hope that helps,

Axel
1 Answer

Michal Suchanek

3/8/2006 8:29:00 PM

0

On 3/8/06, Nuralanur@aol.com <Nuralanur@aol.com> wrote:> Dear Michal,>> hmm.> I have written the most complex Czech text file I could think of containing> the words Cesky and cesky - with hooks, that is, and saved it in UTF8hmm, I wonder why C with a hook is called Ccaron in keymaps..> encoding as file utf8.txt.> Now, having installed Library No. 8 from _http://www.yoshidam.net/Ruby... is much smaller library than icu, and it could be useful for someother text processing.Thanks for the link.But it is still a library one has to install in addition to Ruby. Somepeople who install Debian won't even have a compiler, and almostnobody has a compiler on Windows.Also note that unless you know the language you are processing youcannot get correct upcase/downcase. For one, in most languages usingLatin letters I is uppercase form of i. But I heared that in Turkishthey use both I, I with dot, i, and i without dot. Consequently, I isuppercase form of i without dot ..ThanksMichal-- 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.police...