Answer the question
In order to leave comments, you need to log in
How to configure unserialize for data from mysql?
Good day. The apache server and mysql were configured to work with win-1251, then the settings were changed to utf-8.
Answer the question
In order to leave comments, you need to log in
Encoding problem. How were the settings changed from win-1251 to utf-8? The iconv php function will help you, var_dump(unserialize(iconv("UTF-8", "windows-1251", $data['C_FIELDS']))); (If it doesn't work, try swapping encodings).
But this is a bad option, you need to recode the table normally, then you won’t have to change anything in the code. In addition, if new data is entered into the table, they will already be in utf-8 encoding, and the old data will remain in windows-1251 and in general it will turn out to be a mess. So it is necessary to change the encoding of the entire table / database, more precisely each of its fields / lines. Since before that you entered data there in one encoding, and now you are reading the same data, but specifying a different encoding, although the data remained in the old encoding.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question