Strange characters in rails

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 = Iconv.new( ‘UTF-8//IGNORE//TRANSLIT’,‘WINDOWS-1252’)
@file=ic_translit1.iconv(@file)

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.