InterviewSolution
| 1. |
I Keep Getting An Error: "invalid Utf-8 Character". What's Wrong? |
|
Answer» Most commonly, the XML encoding = declaration is either incorrect or missing. Without a declaration, XML defaults to the use utf-8 CHARACTER encoding, which is not compatible with the default text file encoding on most systems. The XML declaration should look something like this: <?xml version="1.0" encoding="iso-8859-1"?> Make sure to specify the encoding that is actually used by file. The encoding for "plain" text files depends both on the operating system and the locale (country and language) in use. Another common source of problems is characters that are not allowed in XML documents, according to the XML SPEC. Typical disallowed characters are control characters, even if you escape them using the Character Reference form. See the XML specification, sections 2.2 and 4.1 for DETAILS. If the parser is generating an Invalid character (Unicode: 0x???) ERROR, it is very likely that there's a character in there that you can't see. You can generally use a UNIX command like "od -hc" to find it. Most commonly, the XML encoding = declaration is either incorrect or missing. Without a declaration, XML defaults to the use utf-8 character encoding, which is not compatible with the default text file encoding on most systems. The XML declaration should look something like this: <?xml version="1.0" encoding="iso-8859-1"?> Make sure to specify the encoding that is actually used by file. The encoding for "plain" text files depends both on the operating system and the locale (country and language) in use. Another common source of problems is characters that are not allowed in XML documents, according to the XML spec. Typical disallowed characters are control characters, even if you escape them using the Character Reference form. See the XML specification, sections 2.2 and 4.1 for details. If the parser is generating an Invalid character (Unicode: 0x???) error, it is very likely that there's a character in there that you can't see. You can generally use a UNIX command like "od -hc" to find it. |
|