Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to move my WordPress blog from Windows to Linux, but I'm seeing a weird character encoding problem in the Linux version that I'm not seeing on Windows. (I had thought it was an issue with the way I used mysqldump to export the data, but after upgrading mysql, dumping, checking, etc., I'm pretty sure I did that part OK). The data in the database on Windows is exactly the same as it is on Linux.

Here's what apostrophe's look like on my Windows blog:

enter image description here

And here's how it appears on the Linux blog:

enter image description here

As you can see, there's a weird ΓÇÖ series of characters instead of an apostrophe. Is there a setting in WordPress that I need to change to get it to render it correctly?

More details:

Windows, I'm getting back in the response the following bytes for the single apostrophe:

E2 80 99

Linux, I'm getting back bytes for ΓÇÖ:

CE 93 C3 87 C3 96
share|improve this question

2 Answers 2

It looks to me like you're not using an actual apostrophe, but one of the curly apostrophes, such as those that Microsoft Word might be configured to auto-correct to. There is a chance that your mysqldump was actually exporting it incorrectly. In my test database, both PowerShell and Command Prompt were dumping as ΓÇÖ, whereas Cygwin was dumping as . If your export does look fine in those areas, you may want to check the Content-Type return header to see that it is specifying UTF-8. If both of those check out, it could be that the database's encoding needs to be modified.

As an alternative, you could replace any occurrence of with '.

share|improve this answer
    
My apologies for the slightly vague answer, but I do not have the ability to comment everywhere yet. –  Doug Aug 18 '12 at 13:56
    
vague is fine. Those are some good things to check. –  Ben McCormack Aug 18 '12 at 13:58
    
Content type for both is text/html UTF-8. Looking at the source of what was returned, Windows host is returning and Linux host is returning ΓÇÖ. –  Ben McCormack Aug 18 '12 at 14:03
up vote 1 down vote accepted

The problem ended up being (I think) Powershell's wrangling of the output from mysqldump. In powershell, I had been using:

mysqldump -u**** -p**** -h**** wordpress --default-character-set=utf8 | 
   out-file out.sql -Encoding UTF8

I was even good about explicitly outputting UTF8 for both mysqldump and out-file! However, it seems (and this is really hard to prove because it's hard to tell what powershell does with UTF8 multi-byte unicode characters once you pass it to out-file) that out-file is having trouble handling multi-byte unicode characters in UTF8.

I switched to using the plain old Windows command prompt, which outputted data correctly:

mysqldump -u**** -p**** -h**** wordpress --default-character-set=utf8 > 
    out.sql
share|improve this answer
    
After digging in a little more, I think that it might still be mysqldump, not powershell, but the weird thing is that for some reason cmd's output works, whereas powershell's does not. –  Ben McCormack Aug 21 '12 at 14:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.