XML to UTF-8

Questions about XML that are not covered by the other forums should go here.
srr
Posts: 1
Joined: Fri Jan 02, 2009 11:58 pm

XML to UTF-8

Post 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?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XML to UTF-8

Post 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
Post Reply