XML file encoding format “utf-8” VS “UTF-8”?

后端 未结 5 404
刺人心
刺人心 2021-02-01 15:46

When the XML file was convert to ASCII. It is different values for user at the three characters of utf and UTF.



        
相关标签:
5条回答
  • 2021-02-01 15:52

    Upper-case is the de-facto standard. It should still work with any combination of case, however.

    0 讨论(0)
  • 2021-02-01 15:58

    From the XML specification:

    "XML processors SHOULD match character encoding names in a case-insensitive way"

    This indicates that you can use upper case or lower case or even mixed case if you wish. However, the specification uses "UTF-8" in all its examples so for consistency I'd go with that.

    0 讨论(0)
  • 2021-02-01 15:58

    In my experience (which is primarily with .NET), character set identifiers are treated as case-insensitive, so UTF-8 and utf-8, as well as Utf-8 or any other variation thereof, always mean the same thing. This would also be the case for other character sets, such as ISO-8859-1 (Latin 1), etc. The casing should not matter, as case is not a meaninful factor in such an identifier.

    I do extensive work with web services across multiple platforms, and I have never really seen a "standard" form used. I've seen every variation of a variety of character sets...often different variations from a single business partner.

    0 讨论(0)
  • 2021-02-01 16:00

    For those interested in the gory details - including links to some of the related standards and precedents - I blogged a couple of years ago about Case-Sensitivity of UTF-8 in XML Declarations.

    0 讨论(0)
  • 2021-02-01 16:15

    The IANA character set registry says:

    no distinction is made between use of upper and lower case letters.

    But that page, the XML specification, and unicode.org are consistent about capitalizing UTF-8.

    0 讨论(0)
提交回复
热议问题