How to upcase/downcase utf-8 chars?

E

es_

Hi,

I want to upcase/downcase utf-8 characters. How to do it with ruby?

I googled the web with no satisfying results. I also installed
character-encodings (0.4.1) but have no idea how to use it (the
documentation is really pure).

If I put " require 'encoding/character/utf-8' " line to my script I
get:

"(...) in `require': no such file to load -- encoding/character/utf-8
(LoadError) (...)"


Docs say:

"To compile:

$ rake

To test:

$ rake spec"


I get:

"(in (...)/character-encodings-0.4.1)
rake aborted!
no such file to load -- spec/rake/spectask
(...)/character-encodings-0.4.1/rakefile:10
(See full trace by running task with --trace)"


Docs say:

"It’s basically the following:

require 'encoding/character/utf-8'

str = +"äbc"
str_that_is_the_same_as_previous_str = u"äbc"

There’s no install task yet, so until then, just load Ruby as follows:

$ ruby -Ilib:ext

and you’ll be able to require the library as shown above."


I get:

"(...) in `require': no such file to load -- encoding/character/utf-8
(LoadError) (...)"

....

Could anyone tell me how to upcase/downcase utf-8 characters? Is it
that hard?! it should be damn simple as it is a damn simple feature...

Greetz,
Timo
 
L

Luis Parravicini

Hi,

...

Could anyone tell me how to upcase/downcase utf-8 characters? Is it
that hard?! it should be damn simple as it is a damn simple feature...

Greetz,
Timo

Hi Timo

Try using the rubygem Unicode:

irb -rubygems -runicode
irb(main):001:0> puts Unicode.upcase('=E4=EB=EF=F6=FC=E1=E9=ED=F3=FA=F1')
=C4=CB=CF=D6=DC=C1=C9=CD=D3=DA=D1
=3D> nil

Bye


--=20
Luis Parravicini
http://ktulu.com.ar/blog/
 
M

Michael Guterl

Getting no response =3D it is impossible?!

Did you not see Luis Parravicini's response? If for some reason there
is some type of disconnect between the forums, gateway, and ML, here
is Luis's message again.

Hi Timo

Try using the rubygem Unicode:

irb -rubygems -runicode
irb(main):001:0> puts Unicode.upcase('=E4=EB=EF=F6=FC=E1=E9=ED=F3=FA=F1')
=C4=CB=CF=D6=DC=C1=C9=CD=D3=DA=D1
=3D> nil

Bye
 
E

es_

Hi,

Thanks for responses. There's some bug in RubyGems, I just send a bug
report.

Greetz,
T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top