I’m having an issue with my WordPress install. Somehow all the content was inserted in the database with a wrong charset, but in the frontend is working smoothly.
As you can see here:
http://prntscr.com/8vifc3
I’m changing my host, but when I imported my site won’r render the encoding properly because of the way that the content was inserted.
There’s a way so I can fix the encoding directly in my previous mysql before I export it?
Thanks
You can fix the issue by converting your strings to binary and then do charset conversion. The example below converts
UTF8
data toCP1251
:you can use set_charset` function
in mysqli
or you can change the charset from phpmyadmin to
utf8_*
That’s Mojibake
SET NAMES latin1
(orset_charset('latin1')
or …), probably by default. (It should have beenutf8
.)CHARACTER SET utf8
, but it should have been that.If you need to fix the data it takes a “2-step ALTER”, something like