4/22/2013

Odd character codes showing up in MovableType posts

The most likely cause of character encoding problems occurs because of a mismatch of instructions. Most often this happens with extended characters like smart quotes, apostrophes, ellipses, en-dashes, foreign characters, etc.

In the MovableType configuration file -- mt-config.cgi -- there may or may not be a line that looks like this:
  • PublishCharset iso-8859-1
Also, there may or may not be a line in your HTML (5) <head> code that looks like this: 
  • <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
The important part of these lines is the value of the charset -- in this case it is "iso-8859-1."

If you make sure that both of these lines exist, there should be more consistency between the character encoding that MovableType spits out and the character set that the browser is expecting to receive.

Also, the "iso-8859-1" charset is no longer supported, so you are probably better off with "UTF-8".

So, the mt-config.cgi file should have a line under "#======== REQUIRED SETTINGS ==========" that looks like this:

  • PublishCharset utf-8
And the <head> code of your templates should contain a line that looks like this:
  • <meta http-equiv="content-type" content="text/html; charset=utf-8" />
When you are done updating these settings, you need to republish your whole blog by clicking on the publish button (which looks like tow arrows chasing one another in a circle), and hitting Publish for All Files.

No comments :

Post a Comment