Version Française
( Blog «unicode»)

Typeface has a bug with word boundaries and special caracters(Unicode) - IE

Written by David Grégoire | 23 March 2010 | 8

We use regularly Typeface to apply a particular font to text on websites.

A bug happened: the regex engine splits the word "français" in "franç" and "ais". The split happened when the engine meet an accented caracter, UTF8 or Unicode.

The effect was invisible in many browsers, but in Internet Explorer, a space was inserted because the script created two distinct markups.

There is a solution! You just have to change line #289 of typeface.js to this:

var words = text.split(/\b(?=\X)/);

Et l'affaire est ketchup !

Credits: http://twitter.com/tousdan

Tags: accents, caracteres spéciaux, java, regex, typeface, unicode,

Category: Free stuff

Share: