Support » How-To and Troubleshooting » Convert database to UTF-8

Convert database to UTF-8

  • Hi,

    I noticed that a guide for converting the WordPress character set is now available on the Codex. However, its instructions are pretty vague and I’m not comfortable following them.


    Has anyone tried this successfully? If so, what were the commands you used to convert the database? I would love it if someone would post a SQL script to achieve this. Such a script should be bundled with the next WordPress install.

Viewing 15 replies - 16 through 30 (of 38 total)
  • pdelisle


    andersapt’s script URL (http://kunde.apt.no/aso/wordpress/convert_to_utf8_sql_generator.txt) throws a 404 error.

    Can someone post the correct URL or email me the script (philip at de-lisle.co.uk) as I have to move 20+ blogs to a new web host for clients and I don’t have access to their WP control panel to be able to use the wp_backup plugin (which works fine when phpmysqladmin doesn’t – weird)




    Has anyone tried to start g30rg3x’s plugin (utf8-database-converter) to work with WP2.3?
    I’m a bit carefull because in his readme he states “This plugin has been designed to be only compatible with WordPress versions 2.2.x and 2.1.x so running the plugin on other minor or major versions may have unexpected behavior.”



    As stated in the “readme” file and in the warning before the final step, i haven’t fully tested under 2.3.x so i don’t know what behavior to be expected, but my guesses and of course as the main developer of the plu in i have to say: “Why it shouldn’t?”, my guesses is that it will work fine.

    But i sure recommend to you (and all) to wait i little time because i started to develop the next version that will have new features, more compatibility across different mysql and php versions and of course a fully support of 2.3.x so i encourage you to wait a little extra time but of course if you need ASAP solution i will suggest to give a try to the current/stable version.

    Greetings From Mexico

    I tried g20rg3x’s plugin and received the following error:

    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/myuname/public_html/wp/wp-content/plugins/UTF8_DB_Converter.php on line 115
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/myuname/public_html/wp/wp-content/plugins/UTF8_DB_Converter.php on line 115
    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/myuname/public_html/wp/wp-content/plugins/UTF8_DB_Converter.php on line 115

    Odd, three times in a row like that. I’m on WP 2.2x and the first time I tried, this popped up quite quickly. I look around a bit, and tried it again just to see and it went serveral minutes, used mysql memory quite a bit, and then spit out the same error 3 times. I don’t think there is anything special about my install, but I’ve desperately been wanting to convert over to utf-8 so this is just wonderful if it will work for me.

    I’m open for suggestions on debug.

    Thank you!

    Hi DavidRoberts…

    That error means that the SQL Query that should be executed on line 114 is not… for consequence the mysql_fecth_assoc() function cant have a valid mysql resource.

    This is related to your mysql user privileges, if your user doesn’t have grant access to Show_view_priv the EXPLAIN SQL Statement will does not work properly.
    This is unfortunately a know-bug that is already being work-around in the version 3.0…

    If you need further help about contact me over my email, (is in the read btw)

    Greetings from Mexico

    I tried g30rg3x’s plugin on a v.2.3.1 site and it seemed to work fine. It complained about the WP version (which I expected) and warned about possible data loss (ditto). When I crossed my fingers and said “Run it anyway!” it quickly threw me back to the version-warning page, so that I didn’t it had done anything. So I ran it again! Same thing, so I checked my database and saw that the conversions were indeed made; then checked my blog, and the Cyrillic and accented characters and so on were rendering correctly. Given that it seemed to work, I was surprised at how fast the script ran (I guess I have a small blog).

    I wonder what would have happened if I had hacked the version check to include 2.3, but at this point I’m grateful to be running utf8. Gracias!

    Dear, g30rg3x.

    When I made step one for my fresh 2.2 upgrade, wrote define(‘DB_CHARSET’, ‘utf8’); in wp-config.

    I get a nasty error:

    Warning: Invalid argument supplied for foreach() in /home/***/public_html/wp-includes/capabilities.php on line 31

    Warning: Cannot modify header information – headers already sent by (output started at /home/***/public_html/wp-includes/capabilities.php:31) in /home/iskall/public_html/wp-includes/functions.php on line 1348

    You do not have sufficient permissions to access this page.”

    I actually got the same errormessage when I tried to convert directly with your plugin under 2.1.

    Thank you.

    Hi alexz,

    I think that problem is directly related to your recently update/fresh WordPress 2.2 and your server.
    You should see
    It maybe help you….

    Also read this entry…

    Greetings from Mexico

    Thanks for your fast answer g30rg3x.

    If I set magic_quotes_runtime in my .htaccess file I only get Internal Server Error when I try to get into the wp-admin. No error log is created.

    My older install of 2.1 got the same error when I only converted my database with your plugin. I had to ask my host to upload the backup again (because phpmyadmin failed to upload my own sql backup).

    So I tried to upgrade to 2.2 and followed your readme file, as I said. I only have to write define(‘DB_CHARSET’, ‘utf8’); to create this error.

    Hi Alexz,

    Unfortunately this is still a server side problem, so m sorry to tell you that there is really nothing i can do (as the plugin main developer).
    You should check that you upload all your files correctly and that you have and a supported php and mysql version for WordPress also i totally suggest you to drop version 2.2 and start using 2.3…

    Greetings from Mexico

    Well, I then drop 2.2 and update to 2.3 and wait for your plugin to be 2.3 compatible.

    Thanks for your help!

    I just tried g30rg3X’s plugin in WP 2.3.2 and it worked fine for me.
    Just to let you know!

    Nope – it did not work for me on 2.3.2

    The script reported Done. But it truncated every post after the first 60(?) words or so.

    Lucky I had a backup!

    I got the same deal as zern got trying to use this plugin to convert a 2.3.3 WP: all the old posts truncated at 60 words or so. Oh well…

    went fantastically well for me, moving a 2.1x to 2.3.2, no issues at all. THANK YOU g30rg3x!!!

Viewing 15 replies - 16 through 30 (of 38 total)
  • The topic ‘Convert database to UTF-8’ is closed to new replies.