I checked out the headers and they are sending:
These are sent by browser, how does server response look like?
Look for the ‘Content-type’ header.
My database is using ISO Latin 1.
This may or may not be the problem. It is possible (but not advisable)
to keep utf data in
database tables with Latin 1 encoding.
However it would be better to convert your tables (and data) to UTF,
then make sure that you
have line ‘encoding: utf8’ in your config/database.yml
This part is confusing, so I’ll try to describe some scenarios:
a) Database’s encoding is set as Latin 1 (default) and there is no
encoding line in config/database.yml. This will work, at least data
can be saved/retrieved and displayed correctly
in the browser - given the HTTP headers are right.
b) Database’s encoding is Latin 1, but database.yml sets encoding to
UTF. This will not work, because that line makes database client to
issue “SET NAMES UTF8” when connecting to the database. In this case
MySQL will try to convert data which it thinks is in Latin 1 to UTF.
Alas, data is already UTF, but wrong encoding was specified–what you
get is useless conversion and character junk.
c) Like b), but in this case database is set to UTF, and data is in
UTF, but there is no encoding line in database.yml. In this case
connection’s encoding will be Latin 1 and MySQL will try to convert
data from UTF to Latin 1. This will mess things, assuming HTTP
headers/meta tag says that encoding is UTF.
So what would I do in your situation:
- Try to change view-encoding to UTF-8 in the browser. If that fixes
how characters are displayed, then, most likely, HTTP headers are
- Check ‘Content-type’ header of the server response. If it says
anything else than UTF - that must be fixed.
- When headers are ok and page is displayed the way it should -
convert tables and data in DB to UTF and then add encoding: utf8 to
Of course other scenarios are likely too, which would require