Encoding error

I create scaffold and trying to save text with cirllic symbols i recieved: Encoding::UndefinedConversionError: U+043F from UTF-8 to US-ASCII: my database charset is utf8 in database.yml encoding:utf8 why rails is still trying to convert text to ascii? what should i do to save my data in utf8?

What is it that raises this error ? If for example you were writing data to a file you would need to make sure that the file was opened with the correct encoding set. Another problem that can occur is if you have a utf8 string that has come from your database but you then perform some operation with a string literal. Unless your files have a magic encoding comment at the top, that string literal will default to ASCII.

Fred

Hi,

El 04/09/2011 20:53, Ilya Boltnev escribi�:

I create scaffold and trying to save text with cirllic symbols i recieved: Encoding::UndefinedConversionError: U+043F from UTF-8 to US-ASCII: my database charset is utf8 in database.yml encoding:utf8 why rails is still trying to convert text to ascii? what should i do to save my data in utf8?

     Difficult to know where exactly is the problem, I work with latin symbols and after many encodings problems, I always convert the files to utf-8 (without bom) and add the magic comment "# encoding: UTF-8" to all the ".rb" and ".erb" files.