Unwanted special characters in web content

Have you ever been frustrated by unwanted special characters showing up in a web page or email that you coded?

The problem might look like this: 

Screenshot of the capital A circumflex character

In your editor, at left, you may not see that there is a problem at all. But in a browser, at right, you see strange characters that you didn’t intend to be there.

Special characters after pasting content from Word

When I searched to find the name of this special character, I found it is called Circumflex. If you really do want this character on your web page, here is a FileFormat.Info page about the A with circumflex character.

Advanced tips

Not all site users have access to change the code in the head or the stylesheet of their site, especially if the site is in a content management system. The main reason these unwanted special characters show up is when a.) a web worker pastes in content from Microsoft Word and b.) lack of (or a mismatch in) character encoding.  If you are up for an advanced lesson on why unwanted special characters show up, then read this thorough explanation of character encoding at HTML Purifier.

Preview your work before go-live

If you are working for a large business with an established web presence, you may have two servers set up called staging (or development) and production. In this case, post your content to staging first and never skip this last step of examining the content in a browser. It’s a best practice to keep at least three browsers on your computer so you can see what your users are seeing, no matter what browser they choose. Then you can catch those unexpected special characters before the page goes live to production. When I work on the web, I set up my computer with Firefox, Chrome, Internet Explorer, Safari, and Opera.

If you are just starting out with making a site, you may not have the luxury of a staging server and every change you save goes live instantly. In this case, see if your CMS has a preview button and use it regularly.  You could also use your CMS in, say, Firefox, and preview your site in another browser, such as Chrome. Use the browser’s refresh button or shift+refresh to pull down new changes that you saved from the other browser.

Unwanted special characters in emails

If you are coding an email to send to a list, you can also preview your changes before hitting that big ol’ send button. Just send a test copy to yourself first and be sure to inspect the email for unwanted special characters. You could send the email to an account you check in Outlook, one in Gmail, and one in Hotmail, etc. Each email client could potentially render your content slightly differently.

Recap

For unwanted special characters, a beginner’s tip is to delete the space that is causing the issue and type a new space character. Then, preview your work in several browsers before go-live.

Beginner and advanced tips on getting rid of unwanted special characters.