Reputation: 95
I have an issue with swedish characters (those that are different from the english alphabet) and how they are inserted into the database.
I use osCommerce, iso-8859-1
are set as charset in both admin and the cataloge pages. And if I run SHOW VARIABLES;
the character_set
in the database is latin1
.
And heres some server settings from phpinfo:
iconv.input_encoding ISO-8859-1
iconv.internal_encoding ISO-8859-1
iconv.output_encoding ISO-8859-1
According to the host support pages Apache deliver all pages in UTF-8
as default, and it can be change by adding
AddDefaultCharset ISO-8859-1
in a .htaccess
file.
When I go to admin to update product all characters in the diffrent input fields ar featched from the database and showed as they suppose to. But when I update the product all special characters are converted like this:
The same happens if I add a new product.
When I look in the database with phpmyadmin the "corrupt" characters are displayed, so its not just the webpage that translate it wrong.
My host recently annoncet that they will do some updates for php, so I think it has to do with this update. It all worked fine some days ago.
I'm not sure of my previos php version, but now I have 5.2.17 and mysql is 4.0.27-standard
Can someone help me out in this matter and tell me what I need to do.
Is there a simple solution, do I need to convert the database and webpage to utf-8 or do I need to do anything else?
Upvotes: 1
Views: 577
Reputation: 111349
It sounds like the web browser is sending the form in UTF-8 rather than ISO-8859-1. Either that or the application (or MySQL client) is converting the text to UTF-8 before writing it to the database. You can check how $text
is encoded by doing a simple echo bin2hex($text);
.
If the problem is with the browser, set the character encoding used to send the form with the accept-charset
attribute in the form tag. That is:
<form action="..." method="POST" accept-charset="ISO-8859-1">
....
</form>
Upvotes: 1