mysql - PHP function unserialize stop working after charset change (from latin1 to UTF-8) -


i use php function serialize serialize object big string, in string special character "—". object save when db using latin1 charset migrate db utf-8.

i use php function unserialize object back, since changed charset utf-8 function stop working. don't know why.

i modify httpd.conf use:

addcharset utf-8 .utf8 adddefaultcharset utf-8 

php.ini:

default_charset = "utf-8" 

and convert mysql data utf-8.

update catch php error when call unserialize function:

unserialize(): error @ offset 19146 of 23672 bytes in /xxx/xxx.php:18 

now, please show create table ... , show results.

if character set of column stored e28094 latin1, have mess. needed converted hex 97, latin1 encoding em-dash, not. had utf8 bytes, (by default) told mysql had utf8 bytes. may read "—" -- latin1 decoding of each byte. because mysql thinks of 3 latin1 characters. here likely solution. but, cautious.

if character set of column utf8, in table.

the long-winded discussion of problems in my blog .


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -