I’m looking for a help with encoding problem I’ve been struggling for couple days now already.
I have a database with Collation “latin1_swedish_ci”. When I view a single entry it shows a messed up text
grieþos informçs
it should be
griežos informēs
Ok so… I tried to output text into browser with php script and set
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257" />
Now… it shows data correctly (“griežos informēs”). What I need to do is convert this data to UTF-8 so I can use
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
and get everything displayed correctly.
I tried to use Notepad2 and create a file with encoding windows-1257 then copy text from database and save it…. same problem.
Tried to even create a table in that database with utf-8 collation and insert data there… no luck – just shows ? where special chars should be.
Any help would be appreciated,
Thanks
(test is the column name)
That will get you the row in the proper character set. You should create a new table using UTF8 then
SELECT CAST(....) FROM old_table INTO new_tableYou may also want to change the character set of the old table to cp1257_general_ci instead of latin1_swedish_ci.
In order to do it without losing data first change the datatype of the column to
blob, then change it a second time to varchar with the cp1257_general_ci, then finally a third time to utf8_unicode_ci (I suggest a backup first, just in case.)