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've noticed that Wordpress has recently started replacing any unicode characters I enter with question marks. There are a couple of people who've had this issue on the word press forums but no one seems to have an answer to it.

Has anyone got a solution to this?

I self host wordpress, but I've not got much control over PHP and DB settings. It's possible my host has updated the PHP libs or the DB. How would I find out?

share|improve this question
add comment

3 Answers

There's a big chance you can fix this by adding 1 line to your .htaccess file

AddDefaultCharset off

Alternatively replace "off" with the actual charset you want to use.

share|improve this answer
add comment

Omar,

A good article about charsets can be found at http://codex.wordpress.org/Converting_Database_Character_Sets.

Unless you have very specific requirements to the languages you are using, you will want to use charset utf8 with collation utf8_general_ci.

The default WP settings are OK for this. I.e. charset definition in wp-config.php will be UTF-8. No collation specified in that same file. In WP admin read settings, encoding will be set to utf-8 as well.

Check your database and database tables; these need to be set to have collation utf8_general_ci. If you're working with hosted WP, there's a fair chance these will have latin1_swedish. If you dont have direct access to phpmyadmin use a plugin like adminer to get access thru wp admin. If you need to convert any of your tables, check the article mentioned above. If your database isnt too big, you can consider just converting and retyping the special characters.

This should solve your problems. If not, let us know!

Cheers, Peter

share|improve this answer
    
PS Also see to it that your html document has an utf8 definition like so: <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />. In a normal WP installation this will always be the case for the backend. The frontend depends on your theme; you might need to correct that ~ but i believe i understood that your issues arise from backend editing. –  Peter Mar 7 '11 at 20:15
    
Thanks will give this a shot when I'm next on a PC. –  Omar Kooheji Mar 7 '11 at 20:44
add comment

Ok, here's a tricky variation of this that isn't actually a character set issue... but that LOOKS like one. It's an edge case, but...

The site worked fine on my staging server. All sections of the site worked fine on the live server... EXCEPT for the blog. The blog returned a long line of question marks. To simplify the troubleshooting, I opened the index.php file and nuked everything between the body tags, intending to put some simple "hello world" html there. When I did that, the code shortened and... there were blank lines and a ?> way down on the page. Note that in Textmate this did NOT provoke any syntax errors when I checked for those. But, when I removed that stuff, the page worked fine.

As I said this is almost certainly an edge case, but if everything in the db looks fine and especially if the page has worked on other servers it's something to just check out quickly.

share|improve this answer
add comment

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.