Reputation: 20279
I have a osCommerce 2.2 MST which has some custom additions to it. osCommerce itself is in ISO-8859-1. The addition has a table in a MySQL database which is now in utf8_general_ci (the others are all in latin1_swedish_ci). The php-file I'm calling outputs
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
As I mentioned before the data from the database is in UTF-8. But letters like ö,ä,ü are correct displayed. How can this be? There should be no utf8_decode
. But the letter č is displayed as ?
. I get this directly as result array. If I make the query with phpmyadmin it is correct displayed.
I managed to get all letters correct displayed (only in one section of the script). This is what I made
mysql_query("SET NAMES 'utf8'");
In the php-script I also added
header('content-type: text/html; charset=utf-8');
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
But then other problems occured.
What I want to know why data in UTF-8 is "correctly" displayed when it should be not. And how do I get the letter č correctly displayed?
The system is I find rather complex. Where and how can I look what is wrong here?
Upvotes: 2
Views: 1097
Reputation: 234807
I don't know the sequence of encodings/decodings that your data go through, but the reason that letters like ö, ä, and ü are correct, while č is not, is that ö, ä, and ü can be encoded in ISO-8859-1, but č cannot. You will need to use UTF-8 instead of ISO-8859-1 in your HTML to get č to display.
Upvotes: 2