LKBEN11007: How do I specify the XML encoding in my documents
LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False
Author: Wim Peeters - Keskon GmbH & Co. KG
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.
About the Author
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 in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.