views:

374

answers:

2

So I'm doing some screen scraping with this rails app I author, and when I go to insert some text from the page into the database ... rails refuses to do it (inserting empty strings into the db column instead). I looked more closely and realized that it was doing it if the string contains 'weird' characters.

Weird character would be something like this

Claus Müller

I know this is the case, because I'm looking at the data right before it goes in the db and the text in the string I'm trying to insert, but when the insertion takes place ... nothing is inserted.

If I comment out the utf8 encoding in database.yml, it inserts the data into the database ... but all the text is completely screwed up all over the site?

Any ideas?

A: 

Have you tried to look up what the character encoding is of the database tables created by your migrations? E.g. with MySQL the CHARSET should be utf8.

If you invoke ./script/dbconsole and type SHOW TABLE STATUS; you'll get an overview of all your tables including the character set defined per table.

evaneykelen
I did ... its utf8
concept47
+2  A: 

Sorry guys ... I'm a dork :\ It was my Mysql Client that was having problems with Utf-8 characters, It wasn't showing them even though they were there ...

Thanks for the help.

concept47