I’m trying to get my head around the thinking behind XML’s case sensitivity in the context of the encoding
<?xml version="1.0" encoding="UTF-8"?>
Seen in the context of
Is the XML declaration tag case sensitive? and
Is XML case-sensitive?
Plus the XML specification
https://www.w3.org/TR/xml/#:~:text=XML%20processors%20should%20match%20character%20encoding%20names%20in%20a%20case%2Dinsensitive%20way
Other than the encoding’s value, the declaration <?xml version="1.0" encoding=""?>
clearly is case sensitive as by the standard.
Now two things that I’m not sure about.
If I understood correctly:
- The encoding’s value, e.g.
UTF-8
remains case sensitive.
I.e. bothUTF-8
andutf-8
remain “different”, but their evaluation should be case insensitive, thereby making them equivalent. - With respect to
UTF-8
andUTF-16
, the specification’s preference seems to be the uppercase.
Quote:
In an encoding declaration, the values ” UTF-8 “, ” UTF-16 ” […] SHOULD be used
I.e. the lowercaseutf-8
andutf-16
appears to be discouraged.
I’m particularly concerned about the lowercase utf-8
, which used to be my preference, but it seems that I really should have used the uppercase UTF-8
. Or does this even matter in 2024?