LKBEN11007: How do I specify the XML encoding in my documents


Symptom

You do not have to specify an XML encoding, this will fall-back to the default

Cause

none

Solution

Use the XML declaration or this. For example, to specify iso-8859-1 (Latin-1) encoding:

<?xml version="1.0" encoding="iso-8859-1" ?>

The values for the encoding declarations are the charset name defined by the IANA (Internet Assigned Numbers Authority).

There are the same values as for the http-equiv charset meta-tag in HTML.

See http://www.iana.org/assignments/character-sets for the complete list of the IANA charset names.

If the file is provided through HTTP, you can also specify the encoding of a document by using the HTTP charset parameter

in the Content-Type field. However, from a localization viewpoint, it's always better to keep the encoding declaration

within the document itself: as the file will be moved around and processed in non-HTTP environments.

Disclaimer:

The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.