really thanks! This is so clear explanation!

I'd set anything to utf-8,including server,client,my php PDO.
but it didn't work,sounds like my data were encoded (processed) to
another character(gbk) before them were saved into mysql.
so when i checked data from mysql,i will make a hardcode to decode.

On Fri, May 21, 2010 at 4:16 PM, Lester Caine <> wrote:
> cleverpig wrote:
>> thanks Lester!
>> What's double decode? Your meaning is like What's i said:
>> using $ Pdo->   exec ('SET character_set_results = gbk');
>> to make charset_set_results to be gbk?
> seems to have documented everything ;)
> Basically if the data going into a field is wrong, as long as it is read out
> the right way then it will LOOK OK, but if you don't know how the data is
> stored then 'decoding' it may be difficult. I'm not sure quite how PDO will
> handle your gbk data, although in that case it would be single byte and any
> multi byte characters would be dropped ... I think.
> The problem here is that PHP still does not know how to handle UTF8
> properly, so if a multibyte character string is provided and is stored in
> what is essentially a single byte per character field in the database, as
> long as all the extra bytes are saved, reading it back will be OK ... unless
> the bytes are then processed to another character set before saving! THEN as
> long as the 'unprocessing' when you read back is transparent, the data will
> read OK, but trying to read the data directly in the database would not give
> the same result. Your request to read back as gbk will only work if what was
> stored can actually be correctly converted to gbk!

> --
> Lester Caine - G8HFL
> -----------------------------
> Contact -
> L.S.Caine Electronic Services -
> EnquirySolve -
> Model Engineers Digital Workshop -
> Firebird -
> --
> PHP General Mailing List (
> To unsubscribe, visit:

Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to