Page 1 of 1

XML to UTF-8

Posted: Sat Jan 03, 2009 12:02 am
by srr
I have a client that is saying that my xml is not utf-8 and I am not sure how to check or validate that it is or is not.

At the top of the header I have

<?xml version="1.0" encoding="utf-8"?>
<RECIPES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///c:/nobackup/Recipe.xsd">
<RECIPE RECIPEID="2" TITLE="Escargots Red Lion" TTIME="60" CONVENIENCE="Gourmet" IMAGE="2.jpg" COURSE="Appetizers">
<INGS>

Does that not declare it UTF-8 and when I validate should it not notify me that is that it is not UTF-8 if that is the case?

Re: XML to UTF-8

Posted: Mon Jan 05, 2009 1:58 pm
by sorin_ristache
Hello,
srr wrote:Does that not declare it UTF-8 and when I validate should it not notify me that is that it is not UTF-8 if that is the case?
Yes, the declaration

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
specifies that the files uses the UTF-8 encoding. You can check that by reading the file with an XML parser from a command line or from an XML editor tool.

For example Oxygen reports such a problem when you open the file from menu File -> Open. If Oxygen does not report any encoding problem when you open the file then the file content stored in that file on disk can be decoded without problems to text characters using the UTF-8 encoding.


Regards,
Sorin