[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

How to upcase/downcase utf-8 chars?

es_

9/3/2008 11:44:00 PM

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
4 Answers

Luis Parravicini

9/4/2008 8:34:00 AM

0

On Wed, Sep 3, 2008 at 8:39 PM, es_ <esuomikim@gmail.com> wrote:
> 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.co...

es_

9/5/2008 12:53:00 PM

0

Getting no response = it is impossible?!

T

Michael Guterl

9/5/2008 1:03:00 PM

0

On Fri, Sep 5, 2008 at 8:49 AM, es_ <esuomikim@gmail.com> wrote:
> 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

es_

9/25/2008 1:37:00 PM

0

Hi,

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

Greetz,
T