About HTML Entities

Tuesday, October 25th, 2011

About HTML Entities

If you’re using special (non-Latin) characters in your pages or emails, you’ll want to convert those characters to HTML Entities. This naturally raises a few questions. What are HTML Entities? Why does it matter? What will happen if I don’t? How do I do it? If you already know the answers, great. If not, I’ll do my best to answer them now.

What are HTML Entities?

HMTL Entities are a way of representing characters in HTML using different characters. The primary reason for this type of thing is to allow characters that are used for special purposes in HTML to be displayed normally in the text. The most obvious would be < the less-than symbol which is used to mark the beginning of an HTML tag. Without a special way to tell the browser to display the actual symbol, it could never appear in the text of a page. The named entity for the less than symbol is <. All entities begin with the ampersand (&) and end with the semi-colon (;).

But HTML Entities also have another purpose. Whenever any information, including an email or web page, is stored or transferred, it’s represented by a series of 0s and 1s. The character encoding of a document determines how those 0s and 1s will be turned back into text. If a document is stored in one encoding and read based on another encoding, the result could be garbled. Fortunately, character encodings generally agree on alphanumeric and other common characters, so the only thing you need to really worry about is “special” characters.

Why does it matter?

As I mentioned before, if the encoding is changed, the text may become garbled. Although HTML provides a method for specifying the character encoding of a document, it’s generally considered best practice to use HTML entities for special characters anyway, because of the myriad things that can happen to content on the web before it reaches a user’s screen. The most commonly problematic of these is email. Even if you specify the content type of your HTML email in the code, email clients will usually ignore it in favor of the encoding specified in the header of the email by the sending server, or they’ll arbitrarily assume one. Either way, you’re much safer encoding everything questionable.

A Handy Tool

Check out the HTML character encoder from Web2.0 Generators, it can convert all applicable characters to their corresponding HTML entities.

About Matcha Design

Matcha Design is a full-service creative B2B agency with decades of experience executing its client’s visions. The award-winning company specializes in web design, logo design, branding, marketing campaign, print, UX/UI, video production, commercial photography, advertising, and more. Matcha Design upholds the highest personal standards for excellence and can see things from a unique perspective due to its multicultural background.  The company consistently delivers custom, high-quality, innovative solutions to its clients using technical savvy and endless creativity. For more information, visit MatchaDesign.com.

Related Tags

You Might Also Like