Convert a string to utf8

Hello.

I’m reading a csv file into my application, and when I enconter a
special character like ç, I have a problem, since my database is in
utf-8. Is there a way to convert a string to utf-8?

Pedro C. wrote:

Hello.

I’m reading a csv file into my application, and when I enconter a
special character like ç, I have a problem, since my database is in
utf-8. Is there a way to convert a string to utf-8?

OK. Found it myself :stuck_out_tongue:

For someone loking for the same thing …

http://www.ruby-doc.org/stdlib/libdoc/iconv/rdoc/index.html

On Feb 19, 2007, at 7:10 PM, Pedro C. wrote:

I’m reading a csv file into my application, and when I enconter a
special character like ç, I have a problem, since my database is in
utf-8. Is there a way to convert a string to utf-8?

Yes, use iconv. You’ll need to know the input character encoding, or
give

http://raa.ruby-lang.org/project/charguess/

a try otherwise.

– fxn