Some background first:
2003 - 2010
In 2003, I switched from
HTML 4.01
toXHTML 1.0
and encoded my XHTML documents, using:<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
2010 - 2013
In 2010, I switched from
XHTML 1.0
toHTML5
, but, because the text-editor I was using at the time did not allow me to save text documents inUTF-8
, I continued usingISO-8859-1
.The usefulness of saving documents in
UTF-8
only became more apparent to me in early 2013, when I started working on a project about Iceland, involving frequent use of the characters:
æ
/Æ
(ash)ð
/Ð
(eth)þ
/Þ
(thorn)and many accented vowels (
á
,é
,í
,ó
,ú
,ý
).
2013 - Present
So in 2013 I found a new text editor which enabled me to save documents using
UTF-8
encoding and I started using:<meta charset="utf-8">
Here's the key point:
Throughout 2003-10 and 2010-13, on the rare occasion whenever I needed to display an extended Latin character like (â
, é
or ü
), I always used the standard HTML escapes (or HTML entities
) like:
â
é
ü
Since that was already a habit, after I finished my Icelandic project in 2013, whenever I was writing, saving, editing and uploading UTF-8
encoded HTML5 documents, I carried on using:
ß
,ä
,ö
etc. if I was writing something in German;ñ
,á
,ó
etc. if I was writing something in Spanish;ç
,è
,ô
etc. if I was writing something in French
etc.
In my head, I had the idea that it was both safer and better to use an HTML Entity wherever possible. (Perhaps that came from already knowing that it's always better to mark up &
rather than &
and certainly safer to mark up '
rather than '
).
But I've recently come across the following assertions:
It is almost always preferable to use an encoding that allows you to represent characters in their normal form, rather than using named character references or numeric character references.
Source: When Not To Use Escapes by W3
Unnecessary use of HTML character references may significantly reduce HTML readability. If the character encoding for a web page is chosen appropriately, then HTML character references are usually only required for markup delimiting characters (
<
,>
,"
and&
)
Source: Character encodings in HTML by Wikipedia
- You don't generally need to use HTML character entities if your editor supports Unicode.
- the best practice is to forgo using HTML entities and use the actual UTF-8 character instead
- If your pages are correctly encoded in utf-8 you should have no need for html entities, just use the characters you want directly.
Source: When should one use HTML entities? on Stack Overflow
I'm starting to understand that perhaps for most of the 2010s (or certainly during the early 2010s) it was probably still safer to mark up ö
rather than ö
because a document might be retrieved by a user-agent (an older screen-reader for instance) which didn't understand UTF-8
.
But I'm now concluding (not prematurely, I hope) that in 2020, UTF-8
is now so well established as the standard encoding for the web that it's now definitely safe to simply write ö
(without escaping) in a document saved as UTF-8
.
In summary, I understand that while I may still continue to use HTML entities for delimiters like &
, <
, '
etc. - I no longer need to concern myself with using HTML entities such as à
and ê
for Extended Latin characters.
Is this right?
UTF-8
. In 2013 I switched from Notetab to Sublime Text.