Meta content-type tag does matter!

When editing several files for a French web site that contained non-ASCII latin characters I noticed some strange rendering inconsistencies between Safari and Firefox / IE.

Safari was displaying the characters correctly, however Firefox/IE were not. I tried resaving the file in all different encodings from UTF-8, UTF-16, to Western ISO Latin and got very weird results.

Then I noticed a tag that had been in the existing version of the site:

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

Even though my file was saved as UTF-8, this tag was confusing Firefox and IE into rendering my character data incorrectly. Interestingly, Safari was able to look at the actual file encoding and ignore this meta information.

To fix it all it took was making sure the file was saved as UTF-8 and then making sure the meta tag reflected this:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

If you encounter strange character rendering then give this a try!

Pop-up windows that degrade when pop-up blocking is active

Here’s a quick and easy way to open a pop up window that will gracefully degrade to just showing the link in the same window if the user has pop-ups disabled. The “windwidth” and “winheight” params can be changed. This will also center the window on the screen and bring it the the foreground. I’d use this way of opening pop-up windows whenever possible.