InterviewSolution
| 1. |
What Character Encoding Should I Use When Creating Xml Documents? |
|
Answer» The best choice in most cases is either utf-8 or utf-16. Advantages of these encodings include:
The only drawback of utf-8 or utf-16 is that they are not the native text file format for most systems, meaning that some text file editors and viewers can not be directly used. A second choice of encoding would be any of the others listed in the table above. This works best when the xml encoding is the same as the DEFAULT system encoding on the machine where the XML document is being prepared, because the document will then display correctly as a plain text file. For UNIX systems in countries SPEAKING Western European languages, the encoding will usually be iso-8859-1. A word of caution for Windows users: The default character set on Windows systems is windows-1252, not iso-8859-1. While Xerces-C++ does recognize this Windows encoding, it is a poor choice for portable XML data because it is not widely RECOGNIZED by other XML processing tools. If you are using a Windows-based EDITING tool to generate XML, check which character set it generates, and make sure that the resulting XML specifies the correct name in the encoding="..." declaration. The best choice in most cases is either utf-8 or utf-16. Advantages of these encodings include: The only drawback of utf-8 or utf-16 is that they are not the native text file format for most systems, meaning that some text file editors and viewers can not be directly used. A second choice of encoding would be any of the others listed in the table above. This works best when the xml encoding is the same as the default system encoding on the machine where the XML document is being prepared, because the document will then display correctly as a plain text file. For UNIX systems in countries speaking Western European languages, the encoding will usually be iso-8859-1. A word of caution for Windows users: The default character set on Windows systems is windows-1252, not iso-8859-1. While Xerces-C++ does recognize this Windows encoding, it is a poor choice for portable XML data because it is not widely recognized by other XML processing tools. If you are using a Windows-based editing tool to generate XML, check which character set it generates, and make sure that the resulting XML specifies the correct name in the encoding="..." declaration. |
|