# How to upcase/downcase utf-8 chars?

**URL:** <https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658>\
**Category:** Ruby\
**Created:** [September 4, 2008, 1:45am UTC](https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658 "2008-09-04T01:45:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![es\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@es\_S](https://www.ruby-forum.com/u/es_S)\
**Post date:** [September 4, 2008, 1:45am UTC](https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658/1 "2008-09-04T01:45:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![es\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@es\_S](https://www.ruby-forum.com/u/es_S)\
**Post date:** [September 4, 2008, 10:39am UTC](https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658/2 "2008-09-04T10:39:49Z")

</div>

On Wed, Sep 3, 2008 at 8:39 PM, es\_ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![es\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@es\_S](https://www.ruby-forum.com/u/es_S)\
**Post date:** [September 5, 2008, 2:55pm UTC](https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658/3 "2008-09-05T14:55:46Z")

</div>

Getting no response = it is impossible?!

T

---

<div class="post-metadata">

**Author:** ![es\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@es\_S](https://www.ruby-forum.com/u/es_S)\
**Post date:** [September 25, 2008, 3:40pm UTC](https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658/4 "2008-09-25T15:40:35Z")

</div>

Hi,

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

Greetz,  
T

---

<div class="post-metadata">

**Author:** ![es\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@es\_S](https://www.ruby-forum.com/u/es_S)\
**Post date:** [September 5, 2008, 3:08pm UTC](https://www.ruby-forum.com/t/how-to-upcase-downcase-utf-8-chars/147658/5 "2008-09-05T15:08:39Z")

</div>

On Fri, Sep 5, 2008 at 8:49 AM, es\_ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
