zengun

weblog

20040508

attack of the strange little squares

You’ve got a blog encoded in UTF8, you’re very happy with it, thanks to it your wife has a shiny coat and your dog makes love to you like never before.
Everything falls apart the day you receive a trackback from a blog encoded in ISO8859-15. Suddenly strange little squares (‘unknown character’) are disfiguring your page, the W3C says your blog is invalid trash, your readers are doubting you.

Just when the thought of blog-suicide rears its ugly head, you remember your blog is powered by WordPress, which has a très geek filters function!
The solution (after a look at the documentation) comes naturally: <?php add_filter('comment_text', 'utf8_encode'); ?>

There, now you can receive trackbacks from anyone without worrying whether they were sent in UTF8 or not!


2 responses

  1. Magnifique. Maintenant, deux questions:
    1) La traduction de WordPress devrait-elle être n utf-8 ou en iso-8859-15 ?
    2) Que faire quand les petits carrés apparraissent directement dans les commentaires ? =)
    http://intraordinary.com/weblog/archives/hokuto-no-ken-vs-script-kiddies#comments

    #1 Xavier — 2004/05/14 at 14:03

  2. J’aimerai faire marcher WordPress avec Zempt. Si je force Zempt a donner le bon type d’encodage ou encore si je le force encoder en UTF-8, ça devrait marcher coté WP ? Pour le moment j’ai Zempt qui envoie de l’iso 8859 1 en disant que c’est de l’utf-8 ce qui n’est pas terrible…J’aimerai savoir comment va évoluer XMLRPC dans WP pour voir ce que je fais dans Zempt. (Je ne fais pas officiellement partie de leur équipe mais vu l’activité sur leur projet depuis des mois je peux faire les modifs nécessaires pour que ça marche.)

    #2 Roland — 2004/05/16 at 17:15

Your words


Required fields:
Are marked by this sign: *
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>
On comment spam/irrelevance:
Your comment may be moderated or considered as spam by the leprechauns running this server. If you get a 412 error or a mean message, it may be that they thought it was spam: try wording the comment differently or remind me to put up a contact form so you can warn me about the problem.
Of course, once the leprechauns are done doing their magic, I reserve the right to delete any comment for any reason.