admin管理员组文章数量:1129198
I recently moved my WordPress-based site from DreamHost VPS to a Linode VPS running Debian + LEMP. After getting the site up again, I noticed many erroneous characters in posts; characters like " and - were being replaced with gibberish.
After doing some looking, it seemed clear that the issue was something related to character encoding.
I found a guide that suggested editing wp-config.php
and commenting out the lines:
define('DB_CHARSET', 'utf8');
and define('DB_COLLATE', '');
I did this and it fixed the problem, but I'm wondering if that was the best way to go about it. Thank you for any advice.
I recently moved my WordPress-based site from DreamHost VPS to a Linode VPS running Debian + LEMP. After getting the site up again, I noticed many erroneous characters in posts; characters like " and - were being replaced with gibberish.
After doing some looking, it seemed clear that the issue was something related to character encoding.
I found a guide that suggested editing wp-config.php
and commenting out the lines:
define('DB_CHARSET', 'utf8');
and define('DB_COLLATE', '');
I did this and it fixed the problem, but I'm wondering if that was the best way to go about it. Thank you for any advice.
Share Improve this question edited Jun 7, 2011 at 14:36 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Mar 5, 2011 at 16:38 Evan WondrasekEvan Wondrasek 4881 gold badge3 silver badges13 bronze badges 1- I could be wrong here , but when I had a the same problem when moving servers it was do to saving the file in ascii instead of utf format – Bainternet Commented Mar 5, 2011 at 16:41
4 Answers
Reset to default 4After spending the entire day working on this, I finally found a guide that worked perfectly:
- https://theblogpress.com/blog/seeing-weird-characters-on-blog-how-to-fix-wordpress-character-encoding-latin1-to-utf8/
Before that, I tried following @Rarst's information, tried exporting the database and manually cleaning it, tried the UTF-8 Sanitize Plugin with a modified version from here http://www.prelovac.com/vladimir/ultimate-solution-to-weird-utf-character-encoding-problem (which actually worked pretty well, but didn't fix all the characters. And was probably a terrible idea).
Anyway, if any of you ever encounter this problem, check out the first link I posted. The procedure was pretty simple and basically came down to replacing SET NAMES latin1
with SET NAMES utf8
after exporting the database, then making sure to import the new cleaned database explicitly as UTF8.
Here is another solution which worked for me...
just comment DB_CHARSET
and DB_COLLATE
in wp-config.php
//define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', '');
See Converting Database Character Sets in Codex. Article has note about being completely rewritten at 3.0.1 version so info should be up to date.
I transitioned my website files from an old to new directory and I was able to modify:
define('DB_CHARSET', 'utf8mb4');
to
define('DB_CHARSET', 'utf8');
And this resolved the black diamond whitespace issue.
本文标签: wp configCharacter encoding issue after changing servers
版权声明:本文标题:wp config - Character encoding issue after changing servers 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736738806a1950397.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论