Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dcfb6d6d80251c4b04b109ccd67ebcc5?d=identicon&s=25 Giantiago David (giantiago)
on 2008-11-28 15:59
I wrote some time ago a post about how to deal with some strange
characters (Brazilan Portuguese in my case) that appears mysteriously
sometimes in our dear Rails apps.

Note that is is a different problem that the Multibyte solves.

For Latin languages, this can be quite annoying and most times very
difficult to deal with. I read a article, I will try to find it, but it
basically teach us to stop doing anything related to programing unless
you do understand what character encoding mean. Can't find it but for
the purpose of this post, it is well said.

But it happens that there is *one* way of doing this and the *right* way
of doig thing.

So, my first post was one way.

And this is the right way :

require 'iconv'
ic_translit1 = 'UTF-8//IGNORE//TRANSLIT','WINDOWS-1252')

You should transform the text between the various encodings by correctly
initializing the Iconv object.

Consider what the input text encoding and the output (usually UFT-8 in
Rails) you have to display.

Hope this helps.
This topic is locked and can not be replied to.