International Characters in Textile 2 (Improved)

Recently, I received a comment on the Super Archives about the lack of support for international characters in the implementation. Being a dane I should of course have caught this, but I guess I write too little of my native language.

The comment, however, tipped me off to a problem with both the live preview and the Textile 2 (Improved) plugin. The problem with the live preview was in the Javascript and has been corrected by Jeff Minard, while I haven’t been able to contact Adam Gessaman who’s responsible for the textile plugin (for some reason I can’t leave comments on his blog).

Anyway, for the rest of you who also use the Textile 2 (Improved) plugin I have here included the corrections needed for international character support (this also includes characters like ‘ and – ).

Changes

Change line 2721 from


$html = htmlentities($html);

to


$html = htmlentities($html, ENT_NOQUOTES, $this->options['char_encoding']);

This makes sure the character encoding is taken into account when converting characters to their relevant HTML entities. The default character encoding for the plugin is utf-8 (see below).

Optionally, change line 37 from


$textile->options['char_encoding'] = 'utf-8';

to


$textile->options['char_encoding'] = get_bloginfo('charset');

This is only necessary if you use a character encoding on your blog which is different from utf-8 (not likely, but could happen).

One Response to “International Characters in Textile 2 (Improved)”

  1. Chris Says:

    That was lovely. Fixed.

    You’re like the American Express card.
    Jonas Rabbe, don’t blog without him. :)

Leave a Reply