I have a mysql database using latin1_swedish_ci collation on the table. I will present this data on a web page. I'm trying to use charset=utf8 on the web page that shows the result, but it gives me a lot of strange chars as ? and other instead of the swedish å,ä,ö,chars.
I've tried to use different sql commands to change the data to be "printed". All with bad results. (Collate f.e.)
I am not the original coder for this site and the charset is set to windows-1252.
It works when using this charset (windows-1252), but every native char as å,ä,ö needs to be translated/written as å ,ä ö in the html code for the strings in the html code to be right.
a lot of ? When using charset=utf-8
It would be great to get a solution for this. To get the latin1_swedish_ci mysql table to work together with a web page using charset=utf-8 that is.
Using Collate in sql statements. Like this example SELECT k COLLATE latin1_german2_ci AS k1 FROM t1 ORDER BY k1;
The thing with transcoding between different charsets is that it's not a magic trick. There are things you can't do. However, you can simply transcode your entire database to soemthing that is much more suitable to handle UTF8.
Using WAMP (or simply PHPMyAdmin):
utf8_unicode_ci(orutf8mb4_unicode_ci)Otherwise, you can follow the instruction in the answers of How to change the CHARACTER SET (and COLLATION) throughout a database? for a pure SQL solution.