Posts and comments in “any” language in WordPress!

By | 13/04/2009

Have you ever thought of writing your blog posts in a language other than English? or even let your visitors leave comments in another language!?


Well, some may answer with “Yes! in French!” (or Portuguese, or Italian…), but, what I mean is in other languages like Arabic, Farsi (Persian), Urdu, Chinese…, languages which have characters other than the basic “A,B,C…”

Basically, when you write a blog post on your blog, it is stored in a database, and what characters that database supports, defines the characters you can use for writting your post.


Well discuss about the two general types of WordPress, the WordPress.com blogs and self-hosted WordPress installations.


WordPress.com blogs:


Typing other languages such as Farsi or Russian or Arabic should be supported by default and you should be able to write in almost any language without problem.

But if it’s not enabled on your account, according to Fatih Syuhud [1], you should:

– Login to your administration area on WordPress.com

– Go to “Settings” > “Reading”

– and set the encoding for “Pages and Feeds” to “UTF-8”

This procedure gives you the possibility of writing all kind of characters on your pages and posts and feeds.

Encoding for other specific character:

  • Latin/Hebrew: ISO-8859-8
  • Hebrew: windows-1255
  • Latin/Arabic: ISO-8859-6
  • Arabic: windows-1256


Self-hosted WordPress installations:

Remember that you take full responsability for the modifications and actions you do on your blogs/sites! Proceed at your own risk.


The contents of posts are stored in a table called wp_post (by default) inside your WordPress main database.

What defines the type of characters supported by a table, are the charset and collation of the table.

By default, all installations of WordPress (prior to 2.3.1), use the latin1_general_ci (or latin1_swedish_ci) encoding for their rows and tables.


To post articles in Arabic or Farsi (Persian) (or Urdu, Chinese, Russian…), you should change the encodings of specific tables and respective rows to utf8_general_ci.


Step One: Backup


You should first of all, backup your files and database! use Lester ‘GaMerZ’ Chan’s WP-DBManager plugin, or do it manually by following the procedure from this article: WordPress Backups.



Step Two: Convert


First Solution proposed by Fatih and Mukhlas Rowi [3] ( 70% success rate , maybe some data loss)  is:

– Open your WordPress database in phpMyAdmin (in cPanel),

– Click on the “wp_post” table and then click on “Operations”,

– Change the collation to “utf8_general_ci”,

– Save.

– Now, browse to the “wp_post” table, and check all rows with a collation attribute,

– Click on “Edit” bellow the list of selected rows,

– Change all collations to “utf8_general_ci”,

– Save.

That’ it.


Second solution: Use a plugin to do the conversion! I’ve tested the bbwp2UTF8 plugin and it works great (at least with WordPress 2.7.1), you can download it from my Downloads Page or from WordPress.org home page: bbwp2UTF8 Home page. ( 30% success rate, big data loss)


– Install the bbwp2UTF8 plugin by extracting its content in your plugins directory (usually /wp-content/plugins ),

– Go to the plugin’s page (link is below the “Plugins” section on the left side of the page in WordPress 2.7) .

– Check the desired tables to convert ( I recomment you convert all tables),

– Proceed with the steps to complete the conversion procedure.


That’s all! Your database and tables have been converted in the right manner, and you should not face any loss of data.


(In case you don’t like the plugin suggested above, or it doesn’t work for you, you may try: UTF-8 Database Converter by g30rg3_x ( I haven’t tried this out!) )


Geeks’ solution: Follow the guide at WordPress.org : Converting Database Character Sets



Now you can type UTF8 characters in WordPress and let your visitors type in UTF8 characters in the comments section.



Read More here:

http://codex.wordpress.org/Converting_Database_Character_Sets

http://www.haidongji.com/2008/11/11/convert-character-set-to-utf8-in-mysql/

http://www.prelovac.com/vladimir/ultimate-solution-to-weird-utf-character-encoding-problem

http://codex.wordpress.org/Editing_wp-config.php#Database_character_set

http://www.haidongji.com/2009/02/16/perl-script-to-convert-mysql-character-set-to-utf8/

http://wordpress.org/extend/plugins/utf-8-database-converter/installation/

Ref:

[1]- http://fatihsyuhud.com/2009/01/16/how-to-enable-arabic-letters-in-wordpress/

[2]- http://codex.wordpress.org/Converting_Database_Character_Sets

[3]- http://www.mukhlas-rowi.web.id/2008/11/11/mengatasi-problem-penulisan-huruf-arab-di-blog/

2 thoughts on “Posts and comments in “any” language in WordPress!

  1. suzana

    Hi! I need help to write a page in Arabic – pls help! The text is all over the place! What are some tags I can incorporate to fix this?

    Reply
    1. Gi Post author

      @suzana: Hi, just show me an example of what you’ve got, so I can help you.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge