n NaveenRam
on

 

Hi,

I generated a Define.xml using C#. The generated define.xml like as follows.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="define2-0-0.xsl"?>

Here in the declaration, encoding value is in lowercase (encoding="utf-8"). While validating the xml file in Pinnacle 21 v3.0, I am getting an error as OD0011 - Invalid XML encoding.

If I update the encoding value in upppercase (encoding="UTF-8") in XML file, and validating the file in Pinnacle 21 v3.0 validator, I am not getting the error.

kindly do the needfull.

Here i attached the SampleDefine.xml file as .txt.

Thanks in advance

Naveen Ram. 

Attached Files

Forums: Define.xml

Sergiy
on February 13, 2020

Hi Naveen, 

XML is a case-sensitive language. "UTF" and "utf" are different values. The second one is incorrect.

Kind Regards, 
Seriy

Lex
on February 13, 2020

The names of XML elements and XML attributes are case-sensitive. However, the character sets follow IANA-CHARSETS (Internet Assigned Numbers Authority) Official Names for Character Sets, ed. Keld Simonsen et al. (See http://www.iana.org/assignments/character-sets.).

The statement there is: "The character set names may be up to 40 characters taken from the printable characters of US-ASCII. However, no distinction is made between use of upper and lower case letters."

The XML specifications says: "XML processors SHOULD match character encoding names in a case-insensitive way and SHOULD either interpret an IANA-registered name as the encoding registered at IANA for that name or treat it as unknown.".

The meaning of the word “SHOULD” in the above quoted text is governed by RFC 2119 where it is defined to mean:
“… that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.”

If the writers of the XML specification wanted to insist that processors always treat this in a case-insensitive manner, the word “MUST” would have been used.

To quote the conclusion of a very fine article about this (https://blog.codingoutloud.com/2009/04/08/is-utf-8-case-sensitive-in-xml-declaration/): In summary, if you are producing XML files, it is best to output uppercase “UTF-8” and “UTF-16” since that is always known to be supported. If you are consuming XML files, it is advisable to accept both uppercase and lowercase variants since both are permissible within a strict interpretation of the, uh, “letter” of the standards. And if you are consuming XML files, be sure to handle the case where the optional encoding is not specified at all; the default value is “UTF-8” if nothing else is specified.

 

Want a demo?

Let’s Talk.

We're eager to share and ready to listen.

Cookie Policy

Pinnacle 21 uses cookies to make our site easier for you to use. By continuing to use this website, you agree to our use of cookies. For more info visit our Privacy Policy.