Re: Weird problem with charsets
Posted by: Rick James
Date: November 20, 2009 12:00AM

This is a groß problem...

Immediately after connecting to mysql, do
SET NAME utf8;
This says that the bytes your client sends to the server are utf8 bytes. Then they will be converted to the column type of utf8; that is, they won't need to be changed.

What probably happened is that your PHP code defaulted to latin1 (or something), but really had utf8 bytes in the strings. Then the allegedly-latin1 bytes got converted to utf8, leading to the mess.

Sorry, but the data you already have in the tables is messed up. It may be possible to fix it if you are desperate.

You should never need utf8_decode().

For further analysis,
SELECT length(x), char_length(x), hex(x) FROM table;
where x is the field containing the mangled version of 'die welt ist groß und größer' (or some other suitably short string).

Options: ReplyQuote


Subject
Views
Written By
Posted
3623
November 16, 2009 09:36AM
Re: Weird problem with charsets
2105
November 20, 2009 12:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.