XML documents may contain in foreign characters, like Norwegian ???, Or French ???
External characters, such as Norwegian or French, can be used in XML documents.
To let your XML Parser understand these characters, you should save your XML documents ents as Unicode.
To enable your XML parser to read these characters, you should save the XML document as a unified code (UNICODE)
Windows 2000 WordPad
Windows 2000 notepad can save files as Unicode.
Use Win2000 WordPad to save the file as Unicode
Save the XML file below as Unicode (note that the document does not contain any encoding attribute ):
Save the following XML file as Unicode encoding (note that the following file does not contain any encoding attributes ):
<? XML version = "1.0"?> <Note> <From> Jani </from> <To> Tove </to> <Message> Norwegian: rule? French: Example? Lt;/message> </Note> |
The file above, note_encode_none_u.xml will not generate an error in IE 5 +, Firefox, or opera, but it will generate an error in Netscape 6.2.
The above file does not produce any errors in ie5 +, Firefox, or opera, but it has an error in Netscape 6.2.
Windows 2000 WordPad with Encoding
Windows 2000 notepad files saved as Unicode use "UTF-16" encoding.
Save the file as "UTF-16" encoding format
If you add an encoding attribute to XML files saved as Unicode, Windows encoding values will generate an error.
If you add the encoding attribute to the XML file, the wendows encoding value will produce an error.
The following encoding (open it), will not give an error message:
The following encoding will not cause any errors.
<?xml version="1.0" encoding="windows-1252"?> |
The following encoding (open it), will not give an error message:
Using the following encoding will not produce any errors
<?xml version="1.0" encoding="ISO-8859-1"?> |
The following encoding (open it), will not give an error message:
Using the following encoding will not produce any errors
<?xml version="1.0" encoding="UTF-8"?> |
The following encoding (open it), will not generate an error in IE 5 +, Firefox, or opera, but it will generate an error in Netscape 6.2.
Using the following encoding in IE 5 +, Firefox, or opera will not produce any errors, but there will be errors in Netscape 6.2
<?xml version="1.0" encoding="UTF-16"?> |
Error Message
If you try to load an XML document into Internet Explorer, you can get two different errors indicating Encoding Problems:
If you try to load the XML file into Internet Explorer, you will get two different error messages about encoding.
An invalid character was found in text content.
An invalid character is found in the text content.
You will get this error message if a character in the XML document does not match the encoding attribute. normally you will get this error message if your XML document contains "foreign" characters, and the file was saved with a single-byte encoding editor like Notepad, and no encoding attribute was specified.
If a character in the XML document does not match the encoding attribute, you will get this error message. Generally, if your XML document contains foreign characters, or files are saved in the notepad single-byte Editor, or the encoding attribute is not specified, you will get this error message.
Switch from current encoding to specified encoding not supported.
Switch from current encoding to unsupported specified Encoding
You will get this error message if your file was saved as Unicode/UTF-16 but the encoding attribute specified a single-byte encoding like Windows-1252, ISO-8859-1 or UTF-8. you can also get this error message if your document was saved with single-byte encoding, but the encoding attribute specified a double-byte encoding like UTF-16.
If the encoding property is specified as a single-byte encoding like Windows-1252, ISO-8859-1 or UTF-8, and your file is saved in Unicode/UTF-16, you will get this error message
Conclusion
The conclusion is that the encoding attribute has to specify the encoding used when the document was saved. My best advice to avoid errors is:
The conclusion is that during file storage, the encoding attribute should specify the encoding to be used. My best advice for avoiding errors is:
- Use an editor that supports Encoding
• Use an editor that supports Encoding
- Make sure you know what encoding it uses
• You Have To Find Out What encoding you are using
- Use the same encoding attribute in your XML documents ents
• Use the same encoding attribute in your XML document