Using Unicode in WordPress installed by cPanel

PS (21 April 2010) If all you need to do is make your Hebrew and Greek Unicode look nice please see Phil’s excellent guide at How to Use Greek and Hebrew in Blog Posts (nb. as the post goes on it gets more and more geeky, but the beginning should not be beyond most bloggers).

I am writing this post to help others who have problems with using “International” (Unicode) characters on a WordPress blog installed using their host’s cPanel. Maybe I can save you the hours of searching on the Internetz for the answer :)

The problem I had was that though Unicode (Hebrew etc.) would display and edit fine when I slicked “Publish” it all turned to ??? ?????? ???? which was no use at all.

Some Googling and a few hints from kind friends finally suggested that the problem was the charactersets that the MySQL database (that runs WordPress behind the scenes) was set to use.

You can check if this is the issue by going to phpMyAdmin (in cPanel) click on the appropriate database. On the next screen is a table which includes to the right a collumn “Collation”. The likely problem will be some “tables” have “latin1_swedish_ci” which is (apparently) brilliant for English and other European languages, but no good for other parts of the world, instead of the nice  genuinely International “utf8_general_ci”.

The real bummer is that you cannot simply change this here, that would offend the database fairies, so you need to export your blog (in WordPress admin go to Tools and choose “export”).

Then:

1. Enter your cPanel and click on the phpMyAdmin icon in the Databases box.
2. Select the database you wish to manage from the drop-down menu on the left
3. Click on the Operations tab in the top menu of your phpMyAdmin
4. At the bottom of the page you will see the collation option. You can now select a collation from the drop down menu and click on the Go button.

Now using FTP backup your blog directory (you may want things like the pictures you uploaded, or your theme with any tweaks you made…) and then change its name on your server. Now you can install a new blog with the old name and in the old directory, it will work fine with Unicode characters :)

Just in WP-Admin “Import” the blog you exported, and then copy by FTP the wp-content/uploads directory into the new blog (that gives your pictures etc.) and also the theme you were using into the themes directory (to restore the look and feel. All that’s left is to delete the default “Hello World” post. If you are like me you already have one of those from the original install ;)

Then change the directory name.

12 comments on “Using Unicode in WordPress installed by cPanel

  1. JPvdGiessen

    And now you can type Hebrew or Greek characters ;) Glad the hints helped.

  2. tim

    Yes, though the problem was that though I could type in Hebrew or Greek once I “published” the post the beautiful words vanished and became ??? But yes, hints are a big help, and without yours I doubt I’d have got there :)

  3. Pingback: Tweets that mention Using Unicode in WordPress installed by cPanel - Sansblogue -- Topsy.com

  4. tim

    Thanks Judy, it IS an excellent post, though a bit technical ;) however it does not address the problem I had, which was WordPress not really accepting the Unicode in the first place. However, I will take his advice now I have Unicode working in this install of WordPress :)

  5. Спас Колев

    At least at first sight I solved the problem just by changing with phpmyadmin the collation for post_content field in *posts table (cp1251_general_ci to utf8_general_ci).

  6. CPanel

    THanks for sharing, I was looking for this solution a long time…

  7. didi

    thanx alot for this! solved my problem.

  8. Rohit

    Hey, good post but I am still facing same problem. Could you explain me that FTP name change thing again ? Thanks!

    1. tim

      Sorry I explained that bit badly :(

      If you have material associated with your blog that may not be backed up by WordPress you need to preserve them. The easiest way is to change the main directory name so they are not overwritten by the “new” blog (if you are running in the root directory of the site then you would need to identify the material and copy it elsewhere). Then when the “new” blog is running and the content restored those ancilliary files can be copied or moved back into place.

  9. mohansrinivas

    excellent post,apt solution to my problem but i’m not clear in creating new blog , i did not understand that .
    i took backup of my site and changed the collation to utf8_general_ci in phpadmin.then also i’m not clear with my next step.

    1. tim

      I’m sorry, I am a real amateur in this sort of think what I listed are the steps that worked for me.