I'm working on an upgrade project with an older Magento site, running an old version of Apache. This version of Apache fails to set a UTF-8 character encoding. Instead, the content type header omits an encoding type

Content-Type: text/html

and the browser is left to guess the mystery meat encoding. Firefox reports it as Windows-1252.

enter image description here

We've moved to a new web server, and this new web server is configured to send along the UTF-8 header

Content-Type: text/html; charset=UTF-8

So, we're doing the right thing here, joel is happy, but there's one problem: 5+ years of data entered under mystery meat encoding means there's all sorts of special characters in the database, and when they're served as UTF-8 this happens

enter image description here

For those with images off, that's "Lots of munged encoding".

Are there known solutions for this sort of problem, or am I looking at a lot of manual data scrubbing and/or switching the server back to ambiguous character encoding?

  • 1
    What is about replacing all not english chars in the database sql dump? – Amasty Aug 14 '14 at 6:56
  • What solution have you found? – Amasty Aug 15 '14 at 22:32
  • 2
    This isn't exactly a clean solution, but a hack could be applied to the varien db classes to detect encoding and re-encode using mbstring functions. Probably easier than updating a huge database, but by no means easy. – Matt Dunbar Aug 21 '14 at 14:29
  • are all of the mystery characters windows-1252? – JasonS Aug 21 '14 at 21:43
  • any word on this? – JasonS Aug 31 '14 at 16:35

as far as i am seeing this question you have to repair the data. May be in the content there is some older version encoding thus the apache is not understanding that codes and thats why apache content type header omits an encoding type.

you have image over here showing Degree and Times, can you tell me Encode of that code in your database??? it is &deg??

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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