The following answer on Stack Overflow is famous for its convincing argument against using regex to parse HTML: https://stackoverflow.com/a/1732454/505154

The content of the post becomes increasingly corrupted, and the end should render something like this:

zalgo properly rendered

However on my Windows XP laptop I see the following:

zalgo replaced by boxes

How can I get these "characters" to display properly?

  • On all browsers? – Karan Oct 31 '12 at 21:51
  • I see essentially the same thing on both Chrome and IE, haven't tried any others, – Andrew Clark Oct 31 '12 at 21:53

The simplest way is to download and install a sufficiently large font, such as Symbola, and use Firefox or Chrome.

The problem is twofold. First, the text contains combining diacritic marks that are not supported by the fonts shipped with Win XP. There are some free fonts that you can use to fix this. Second, IE is poor at rendering characters when no font listed in the applicable font-family list covers a character in an HTML document. Chrome and Firefox do a much better job; even Firefox 3, which I tested in a virtual Windows XP system seems to handle the situation OK: it picks up the missing characters from other fonts in the system.

In addition to pages that play with combining diacritic marks in a childish way, there are real pages that make use of such marks. So it’s good to be prepared. There is no single font that covers all characters, so just install additional fonts as needed; Alan Wood has a nice page for downloading fonts with large character repertoires.

| improve this answer | |
  • Thanks, was able to get this to work in Firefox, still seeing boxes in Chrome though. – Andrew Clark Oct 31 '12 at 23:56
  • DejaVu comes pretty close – Cole Johnson Apr 9 '13 at 20:15

It's more than just the character set.

To display that properly, the client rendering the text and any libraries it uses for such need to support combining unicode marks, as well as having the necessary fonts and support for font-stitching to combine fonts as needed.

I think the main font is Microsoft Sans Serif or Arial Unicode MS Regular, which come standard with each version of windows, and has doublessly been updated extensively since it's initial release for XP, probably to include all of the unicode diacritical marks that you see missing here. There might be other fonts at play here, used to fill in gaps in the primary font if it's missing a specific diacritic. I'm not sure of the legal ramifications of downloading a copy of the updated fonts without paying for them (without buying Windows Vista or Windows 7 or Windows 8 for the laptop)

If the issue is a lack of support in the rendering library for combining diacritics, then no amount of fonts will help you display the text correctly. Your only option will be to update the application and/or the libraries that it uses for rendering text.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.