How to upcase/downcase utf-8 chars?

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

On Wed, Sep 3, 2008 at 8:39 PM, es_ [email protected] 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(‘äëïöüáéíóúñ’)ÄËÏÖÜÁÉÍÓÚÑ
=> nil

Bye

Getting no response = it is impossible?!

T

Hi,

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

Greetz,
T

On Fri, Sep 5, 2008 at 8:49 AM, es_ [email protected] wrote:

Getting no response = it is impossible?!

Did you not see Luis P.'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(‘äëïöüáéíóúñ’)ÄËÏÖÜÁÉÍÓÚÑ
=> nil

Bye

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs