Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Last active November 1, 2018 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotherightthing/e05568c5f1840725c04a530710989cff to your computer and use it in GitHub Desktop.
Save dotherightthing/e05568c5f1840725c04a530710989cff to your computer and use it in GitHub Desktop.
[UTF-8] Why UTF-8 is great. #utf8 #I18n #unicode

UTF-8

Some great information from UTF-8: The Secret of Character Encoding.

Meta tag

I've used the charset meta tag with a UTF-8 value for a long long time and now it's the default in HTML5.

While this can also be achieved on the server, the meta tag is an easy and human-readable way to instruct the browser to use UTF-8.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

Note that the characters used to write the META are in ASCII. This solves the problem of the browser not knowing how to interpret the meta tag text until it has parsed its charset value.

I18n

Character entity references are required when using mostly character set A, but needing the odd character from set B or C.

These are difficult to remember and fiddly to write. See Character Entities and Unicode Lookup.

But UTF-8 supports every character. This means that Character Entities are a thing of the past - just copy the real character into your web page and it will just work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment