I just ran into similar problems Abdulaziz. I wrote an import script
that imports data from files into the database. The problem was that
the files were in one encoding (windows-1252) and the database in utf8.
I used the ‘iconv’ library which is available in standard Ruby to
convert the file to utf8 first before attempting to put the data into my
models and save them to the database. (On Windows I believe iconv is
only available in the One-Click installer version of Ruby).
If it is MySQL at least, you can make sure Rails is talking to the
database correctly by adding the “encoding” line to database.yml like
(Be sure to restart Rails after adding this)
If the data is coming from the browser then you need to make sure the
data is being sent correctly. If you are using MySQL you should also
think about installing PHPMyAdmin and checking with that that the data
is being stored properly, as it might just be a display problem.
Also make sure that any templates of pages being sent out to the browser
have the line:
in the and that it is the very first entry.
Hope this helps and good luck.