Notice! This page describes the nature of the error using a hypothetical example and not the erroneous data of the input test file. You should however be able to apply this information to your error case.
Error description:
XML Encoding error is given when validator finds something to be wrong with the encoding of the file.
There are two aspects when in comes to an encoding of XML file:
- The encoding XML file is using
- The encoding reported in the XML declaration within the file
The actual encoding is selected when the file is saved by the system/program producing the file. The encoding within XML declaration is the attribute "encoding" in the first line of XML. Example below:
<?xml version="1.0" encoding="UTF-8"?>
It is worth noting that capitalisation does not matter in the value, "UTF-8" is the same as "utf-8". Encoding UTF-8 is used in this example as it is mandated to be used in ISO 20022 payments.
Therefore, possible causes for getting this error are:
- Encoding given in XML declaration does not match with actual file encoding
- No XML declaration is found. Possible reasons for this include:
- XML declaration is not given in the payment message or is not given in the first line
- Input file is not a payment message or not in XML format
To save a file in another encoding external program has to be used, e.g. notepad.exe allows saving to UTF-8 and notepad++ allows more exhaustive encoding modification.
It is worth noting that revaldate feature in validator is not able to see the original encoding of the file and treats the file shown in the report to be in UTF-8 format. Therefore it may happen that this error "fixes itself" if the cause of error was a mismatch between file encoding and encoding reported in the file.
Short explanation about encoding here