How to Fix a MySQL Character Encoding Mismatch in WordPress

An upgrade to a newer WordPress version, or (as in my case) to a newer version of MySQL, might trigger a problem which has been described since version 2.2: old UTF-8 characters are then represented by strange characters, say “é” will appear instead of “é”.

After reading some posts (e.g. this or this one) about how to fix it, I decided to solve it using one of the simple plugins out there. I tried both, UTF-8 Database converter and WP Sanitize Plugin.

But they just converted the database encoding the simple way. Which was fine, since I don’t care about non-European characters that much. However, there were still a lot of obvious character encoding errors, because the binary encoding was still wrong in many cases.

So I made multiple SQL queries to replace the wrong characters by their correct counterparts, and there it is: I fixed it without using the Shell commands of the aforementioned posts.

If you have the same problem, it will take you seconds to fix your character encoding issue, after having used one of the plugins above (say, UTF-8 Sanitize) and followed its instructions. Then execute the following SQL queries within your blog’s database:

Beware!

  1. Do not change the position of the last query: it should remain the last one.
  2. In that last query, for the wrong character “Ô, you have to choose which of these characters you want it substituted for: “à” (default, preferred if you write mostly in French), “Á”, “í”, “Í” (probably better choices for Spanish blogs), or even “Ï” or “Ý”.

I know, I know, it’s not a perfect solution – but it was indeed easier for me…

WordPress Translation plugin errors corrected – version 1.6.1, now with Google Translate Menu

The latest WordPress Translate Plugin released (1.6) showed an error in the website address conversion. It has been corrected, and a new version 1.6.1 has been released for those languages that had already the plugin with versions 1.5 and 1.6.

Also, a Google Translate Menu version has been included in the plugin package, along with the horizontal and vertical versions. Its output is similar to the one offered by Google, but without the Google style, logos and links, so that it is fully customizable for your blog’s theme. You can see the output of the Translate Menu at the Spanish version of this blog.

Please remember that the IndoEuropean Translator Widget for WordPress is more easily installed, that – unlike this plugin – it includes translation from and into all language pairs offered by Google Translate, and that it also includes all versions offered with this plugin – horizontal, vertical and menu.

The dnghu.php plugin is just a simple code, for those who know some HTML, PHP and/or CSS, who are able to modify the WordPress files, and who want to make the Translation Plugin fit perfectly into their theme.

WordPress Translation Plugin – Added Afrikaans, Belarusian, Persian, Welsh, Irish, Malay, Macedonian, Yiddish..The newest languages in Google Translate

I have added the newest languages offered by Google to the English version of the WordPress Translation Plugin: Afrikaans, Belarusian, Persian, Welsh, Irish, Macedonian, Malay, Swahili or Yiddish.

Because Google is offering a new plugin of its own for any language combination, I think my plugin has become mostly a PHP code to play with, and it will remain so. Their newest Gadget will probably be an excellent tool to offer visitors of any website the possibility to translate with Google, if they don’t have the Google toolbar already installed.

Also, Microsoft is apparently competing with its Bing Translator for the translation engine market, in which Babelfish is still used through Yahoo…

All in all, it’s not a good moment to work on personal plugins that could be replaced in weeks by plugins or gadgets of those big companies, or that could need additions or corrections within weeks. If you want to change or add something to any version of this WordPress Translator Plugin, contact me.

Edit (12 Oct 2009): I’ve added the new language pairs to the German, French, Spanish, Italian, Portuguese and Dutch plugins, which are the most downloaded ones.

WordPress Translation Plugin – Now Google Translation from and into Turkish, Hungarian, Hebrew, Serbian, Slovak, Slovenian, Catalan, Galician, Indonesian,…

The latest improvements and language pairs added to the Google Translation Engine have been included in the simple WordPress Translation Plugin downloadable from this personal blog.

It now includes links to automatic translations from and into all language pairs offered by Google Translation Engine, apart from other language pairs (from individual languages, like English) into other online machine translators, viz Tranexp.

Available language pairs now include (new pairs in bold): English, Albanian, Arabic, Bulgarian, Catalan, Chinese (Simplified and Traditional), Croatian, Czech, Danish, Dutch, Estonian, Filipino, Finnish, French, Galician, German, Greek, Hebrew, Hindi, Hungarian, Icelandic*, Indonesian, Italian, Japanese, Korean, Latvian, Lithuanian, Maltese, Norwegian, Persian*, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swedish, Thai, Turkish, Ukrainian, Vietnamese, Welsh*.

*These languages are only offered as languages to be translated into from the English version.

WordPress Translation Plugin – now using Google Translation from and into Swedish, Finnish, Danish, Norwegian, Polish, Czech, Romanian, Bulgarian, Hindi, Arabic, Japanese, Chinese, etc.

The latest improvements added to the Indoeuropean Translator Widget have been included in the simpler WordPress Translation Plugin available in this personal blog.

It now includes links to automatic translations from and into all language pairs offered by Google Translation Engine, apart from other language pairs (from individual languages, like English or Spanish) into other online machine translators, viz Tranexp or Translendium.

Available language pairs now include English, Arabic, Bulgarian, Catalan*, Czech, Chinese (traditional/simplified), Welsh*, Danish, German, Greek, Spanish, Persian*, French, Hindi, Croatian, Icelandic*, Italian, Hebrew*, Latin*, Korean, Hungarian*, Dutch, Japanese, Norwegian (Bokmål), Polish, Portuguese (Brazilian Portuguese*), Romanian, Russian, Slovenian*, Serbian*, Swedish, Finnish, Tagalog*, Turkish* and Ukrainian*.

WordPress Translation Plugin: ‘Indoeuropean Translator Widget’ – now also Swedish, Danish, Norwegian, Polish, Greek, Russian, Polish, Romanian, Finnish, Chinese, Japanese, Korean, …

The latest upgrades are only available in the simpler WordPress Translation Widget Plugin.

You can download it from the official WordPress Plugin Repository site. New upgrades will automatically appear on your WordPress blog dashboard.

As always, this widget plugin, when activated from the Design tab of your WordPress blog dashboard, will put links – with the tag rel="nofollow", so that search engines don’t follow them – to automatic translations of that website by mainly Google Translation Engine language pairs, to and from (at least) all of these ones into each other, all in all 24×23 language pairs [more or less the number of language translations needed in the European Union…]

The widget offers translations from and into these languages:

English, German, French, Spanish, Italian, Portuguese, Dutch, Arabic, Bulgarian, Czech, Chinese (traditional and simplified), Danish, Greek, Croatian, Hindi, Korean, Japanese, Norwegian, Polish, Romanian, Russian, Swedish and Finnish.

For the latest changes in version 1.1.1 – following Google Translation Engine changes and improvements, you can visit the official release note.

Upgrades for the simple WordPress plugin available in this blog are therefore discontinued not discontinued, due to the need expressed by some bloggers to have this simpler PHP code inserted in their themes, instead of the less flexible widget.

Thanks for the support.

New Version for Spanish Translation Plugin and Translator Widget Released

I don’t have a lot of time to post content on this blog, but at least there are some other WordPress-based websites I have to care of, and they usually include some type of a modified WordPress Translation Plugin.

The Spanish-Catalan translator link didn’t work right, and because of that I substituted it for another translation engine; a Spanish-Galician translator engine has also been added to the plugin, both from the Translendium engine. These two modifications are released with the new Spanish Translator Plugins dnghu_es_h and dnghu_es_v.

Because I have more than 5 (and more than 10) WordPress sites, and because I am used to work with widgets, I’ve finally developed the plugin into an easy-to-install Indo-European Translator Widget, which is actually more of the same code. If you are more used to widgets, or if you don’t need/want to place the translation links outside the sidebar, or if you just like the plug-and-play advantages of widgets, this might be your best option.

(I’ve tried to create a plugin account at WordPress.org for the widget, because now it’s not only about 10 lines of code, and new releases might be for security risks or other bugs – however, three weeks after requesting it, I haven’t received permission yet; I guess I’ll wait a little more and then publish it on the web – I just don’t want to upload things twice, or work more than necessary 🙂

It might seem paradoxial, as I’ve changed the plugin for the widget on this site, whilst in the widget’s site I’ll probably use the plugin: it’s a question of advantage balancing – and, in this very case, of the WordPress themes I’m using for each site.

Indeed, it remains the simplest possible code a non-professional like me could write, so you’ll probably be  able to modify and customise it if and when you want 😉

WordPress Translation Plugin (Catalan, Polish, Ukrainian, Esperanto, etc.) – update v. 1.21 due to invalid XHTML code

The new version 1.2 of the WordPress Translation Plugin had some XHTML invalid code, namely some characters “&” instead of proper XHTML “&” in the new language pairs’ URLs, from some specific Automatic translators.

Thanks to Weakish Jlang for pointing out and solving this error.

[tags]Wordpress,Google,Google translator,Altavista,Altavista translator,Babelfish,Wordpress plugin,translator plugin,blog plugin,blog translator,Wordpress translator,Wordpress translation,translation plugin,blog translation,blog translator plugin,blog translation plugin,WP,WP-translator,WP-translation,WP-plugin,WP translator,WP plugin,WP translation,Tranexp,Poltran,Opentrad,Google translation,Altavista translation,Tranexp translation,Systran,Systran translation,Google plugin,Altavista plugin,Babelfish plugin,Systran plugin,traducteur,Übersetzer,traductor,traduttore,tradutor,vertaler,WP traducteur,WP Übersetzer,WP traductor,WP traduttore,WP tradutor,WP vertaler,Wordpress traducteur,Wordpress Übersetzer,Wordpress traductor,Wordpress traduttore,Wordpress tradutor,Wordpress vertaler,Intertrans,Global,Interpret[/tags]

WordPress Translator Plugin, now version 1.2 in English and Spanish – inglés y español

I’ve added some new pairs which seem to work well – but for the Thai version, which gives usually an error message.

Catalan and Polish languages are now translated automatically, as there is no need to copy and paste the text. New languages include Danish, Persian, Ukrainian, Indonesian, Malay, Thai, Hebrew, as well as experimental Latin and Esperanto options.

Remember you can ask for a translator that works with any language pair included in the English one, although some non-English alternatives include very (very) bad translations.

The Spanish version has been changed to include the Spanish-Catalan language pair, offered by Gencat.

The problem of non-English languages into other languages from InterTrans remains unsolved, as, when it deals with UTF-8, the output shows wrong character processing. If you have any idea on how to correct this (not including the changing of the character set…), please share!

Thanks to all for your comments and posts.

[tags]Wordpress,Google,Google translator,Altavista,Altavista translator,Babelfish,Wordpress plugin,translator plugin,blog plugin,blog translator,Wordpress translator,Wordpress translation,translation plugin,blog translation,blog translator plugin,blog translation plugin,WP,WP-translator,WP-translation,WP-plugin,WP translator,WP plugin,WP translation,Tranexp,Poltran,Opentrad,Google translation,Altavista translation,Tranexp translation,Systran,Systran translation,Google plugin,Altavista plugin,Babelfish plugin,Systran plugin,traducteur,Übersetzer,traductor,traduttore,tradutor,vertaler,WP traducteur,WP Übersetzer,WP traductor,WP traduttore,WP tradutor,WP vertaler,Wordpress traducteur,Wordpress Übersetzer,Wordpress traductor,Wordpress traduttore,Wordpress tradutor,Wordpress vertaler,Intertrans,Global,Interpret[/tags]

WordPress Translation Plugin v. 1.1, now also in Swedish-Svenska

Thanks to George Joyce for the corrections about Araby and Farsi – version 1.1 includes the correct language name.

I’ve also added pairs for Swedish, but they are Tranexp-only, which in my opinion is worse than the usual Google -> Altavista solution which is used in other lesser supported languages like Spanish or Italian.

Also, there seems to be some problem in how Tranexp deals with UTF-8, as the output shows wrong character processing. If you have any idea on how to correct this (not including the changing of the character set…), please share!

Thanks to all for your comments and posts.

[tags]Wordpress,Google,Google translator,Altavista,Altavista translator,Babelfish,Wordpress plugin,translator plugin,blog plugin,blog translator,Wordpress translator,Wordpress translation,translation plugin,blog translation,blog translator plugin,blog translation plugin,WP,WP-translator,WP-translation,WP-plugin,WP translator,WP plugin,WP translation,Tranexp,Poltran,Opentrad,Google translation,Altavista translation,Tranexp translation,Systran,Systran translation,Google plugin,Altavista plugin,Babelfish plugin,Systran plugin,traducteur,Übersetzer,traductor,traduttore,tradutor,vertaler,WP traducteur,WP Übersetzer,WP traductor,WP traduttore,WP tradutor,WP vertaler,Wordpress traducteur,Wordpress Übersetzer,Wordpress traductor,Wordpress traduttore,Wordpress tradutor,Wordpress vertaler[/tags]