WordPress Smart Quote Insanity

Since moving the blog I got quotation mark problems. Smart quotes are showing up as unknown characters. Example here:

Efforts to fix that problem introduced other problems. Anyone know a bulletproof fix?

This entry was posted in Social Media and tagged . Bookmark the permalink.

 

 

4 Responses to WordPress Smart Quote Insanity

  1. Will says:

    I’ve had this occur when the database character set and/or collation are not properly set. Setting them to utf8 and utf8_unicode_ci (respectively) may fix the problem.

    Check out the mysql documentation on converting between character sets
    http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html

    Here's a script I've used in the past for converting an entire database. As usual, use at you own risk.


    SELECT CONCAT('ALTER TABLE `', t.`TABLE_SCHEMA`, '`.`', t.`TABLE_NAME`, '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;') as stmt
    FROM `information_schema`.`TABLES` t
    WHERE 1
    AND t.`TABLE_SCHEMA` = 'database_name'
    ORDER BY 1

    Change 'database_name' to the name of your wordpress database and you should be golden.

  2. Les Jones says:

    Dave: I had tried the functions.php fix, but no luck.

    Will: I think you’re onto something. I’ll backup the database and try that code.

  3. Les Jones says:

    Will, I ran your code and it executed and updated the databases. I still have the same problem, but I think you were on the right track. I’ll check with my Web host tech support and see if they have any ideas.

    Thanks for the tip!