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 <lester@xxxxxxxxxxx> 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? > > http://tikiwiki.org/UTF-8 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 - http://lsces.co.uk/wiki/?page=contact > L.S.Caine Electronic Services - http://lsces.co.uk > EnquirySolve - http://enquirysolve.com/ > Model Engineers Digital Workshop - http://medw.co.uk// > Firebird - http://www.firebirdsql.org/index.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liudan@xxxxxxxxxxx QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: cleverpig.name/dan/ Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php