Flying from Mephisto to Wordpress

Posted by atma on Jul 11, 2008 in Internet & technology |

Mephisto is a blogging engine based on “ruby on rails”. Supports a few things and lacks a dose of thousands of plugins and features compared to Wordpress, not to mention that there is “ease of use” as long as you are HTML-savvy. I chose Mephisto because of user comments and because ROR is generally a better choice than PHP. But these two blogging systems are in no way comparable. The fact is that mephisto’s user database is so small that wordpress developers have not add “import” support for Mephisto. It makes sense to me.

I’m using Dreamhost for hosting my websites so, what I needed to do, was move my database from a Mephisto-style to something that Wordpress can read. The solution came from a script and some MySQL extra tweaks. The first trouble was getting the correct encoding, you see I’m Greek and many posts are written in Greek. The default encoding on dreamhost shell is UTF-8 so I assumed that the default encoding on the mysql database *is* UTF-8. Not to mention that when you first login to “PhpMyAdmin” interface you can clearly see the the UTF-8 encoding as the default choice. Anyway, the entire database was in encoding “latin1″. It took me some time, a few forum posts with no answer and a dozen of hours to get over it.

What I did is export the database using mysql dump, install it on a UTF-8 aware mysql database, at my home server, then using the python script to extract that data in a WXR format that wordpress can read, then import the WXR file to wordpress with the build in function.

So here is how I did. First, after Googling *alot* I crossed Jason’s blog. Grab the script and apply the patch you’ll find there, then run it, on a UTF-8 database. If your database is not UTF-8 then do the following:

$ mysqldump --default-character-set=latin1 -u root -p mephisto > test.sql
$ sed 's/latin1/utf8/g' test.sql > ready.sql
$ mysqladmin create mephisto_utf8 -u root -p
$ cat ready.sql | mysql --default-character-set=utf8 -u root -p mephisto_utf8

If you didn’t understand what we’ve did here is:

  • Export the mephisto database using explicitly “latin1″ encoding
  • Substitute latin1 with utf8 (if that doesn’t work, just do it manually, I did with VIM but here’s a handy sed command line, I’m quite positive it works – feel free to correct me)
  • Create a database called “mephisto_utf8″
  • Import our database in a mysql utf8 powered database
  • Now it’s time to run the python script. After downloading the file and the patch for MySQL from Jason’s blog, just type:

    $ python m2wp-ready.py  -d mephisto_utf8 -u user -p <pass> -o ready.wxr

    Now you should be all the set

    Related posts:

    1. Monitoring your server via twitter! Manolis Kiagias is a FreeBSD addict. He runs the...

    Related posts brought to you by Yet Another Related Posts Plugin.

    Tags: , ,

    1 Comment

    Leave a Reply

    XHTML: You can use these tags:' <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

    Copyright © 2010 Convalesco All rights reserved.
    Desk Mess Mirrored v1.4.2 theme from BuyNowShop.com.