use all uppercase UTF-8 as encoding value in accordance with XML specification
The normative reference for XML is the W3C specification, which says that UTF-8 and UTF-16 are the encodings that all XML processors must accept
The XML spec does not define this value as case insenstive so I think
that means that "utf-8" is different (and undefined). The spec says
that IANA approved values should be used, as defined at:
which defines "UTF-8" yet makes no mention of "utf-8". "UTF-8" is
defined by RFC3629:
but that RFC defers to the Unicode spec for ultimate authority:
which dicsusses UTF-8 in sections 2.5, 2.6, 2.7 and always refers to
UTF-8 with no mention of case insensitivity or of "utf-8".
My conclusion is that "UTF-8" and NOT "utf-8" should be used in XML
In practice this does not appear to make much difference with commonly used tools, but for example I found that firefox 5 does not properly display a feed with high code points unless the declaration is UTF-8 instead of utf-8. Perl does appear to handle UTF-8 and utf-8 synonymously, see e.g. "UTF-8 vs. utf8 vs. UTF8" in the Encode man page: perldoc Encode
I think it is desirable to follow the spec closely and consistently use "UTF-8".
use all uppercase UTF-8 as encoding value in accordance with XML spec…
fix test cases from merge request #2