Writing Devanagari in WordPress

Reading Time: < 1 minute

There are some old posts elsewhere that tell you how to view (and write) Devanagari posts in WordPress. Mostly they say you should enable FireFox as follows: Tools > Options > Content > Default Font Times New Roman > Advanced > Western > Default Character Encoding = Unicode (UTF-8) If only it were that easy today (WP 2.7.1). My problem wasn’t the above – I could view other blogs containing Devanagari words but my post below was not saving the Devanagari contents. Here is my How-To:

  • Use the Google Indic Transliteration tool to write in Devanagari. But you have to copy/paste the text into WordPress.
  • Install and activate the Google Indic Transliteration WordPress Plugin. This adds a check box in the WP post editor. (You have to be in HTML edit mode.) If you check Hindi, you can type in Hindi directly within the post. It does not have Marathi, e.g. ळ so the Google tool is better.
  • Edit wp-config.php to replace the line below with the one after it (copy it and place // to make the original line a comment)
    //define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_CHARSET’, ”);
    (Those are two single quotes after CHARSET’,)
  • Open the MySQL database with phpMyAdmin (supplied with cPanel) and check the Collation language – usually it is latin1_swedish_ci.
  • Select the Operations tab and scroll down to Collation. Make it utf8_general_ci. This will suffice to enable Devanagarifor new posts.
  • Old posts prior to the change will need to be re-edited. You can do it in phpMyAdmin. Choose from the left menu the table called wp_posts. Then select the Browse tab and find the post you want to edit. Click the pencil icon, make the changes and save. That’s it! सकसेस

2 Replies to “Writing Devanagari in WordPress”

  1. This is very helpful article..I struggled more than 3-4 months to make website in marathi…but your article made this logic very simple…

  2. Hi, I followed the instructions you have given and it works but the problem is that other characters like single quote, double spaces are not visible with these settings especially with modifications made in wp-config.php. Please help.

Mastodon