KB Article #176031
XSLT Transformation filter fails with nested fault "XML parse failed: libxml error 9: Input is not proper UTF-8" when using special characters
Problem
XSLT Transformation filter fails with nested fault "XML parse failed: libxml error 9: Input is not proper UTF-8" when using special charactersXSLT Transformation filter is being used to remove the namespaces from a web service XML response. The issue occurs when special characters are present in the XML reposnse. e.g.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<tns:Response xmlns:tns="http://www.axway.com">UTF-8 special characters test é € @</tns:Response> ;
</soap:Body>
</soap:Envelope>
The full error message is:
nested fault: XML parse failed: libxml error 9: Input is not proper UTF-8, indicate encoding ! Bytes: 0x80 0x20 0x40 0x20 : java.io.IOException: XML parse failed: libxml error 9: Input is not proper UTF-8, indicate encoding ! Bytes: 0x80 0x20 0x40 0x20 at com.vordel.mime.XMLBody.parse(XMLBody.java:122) at com.vordel.mime.Body.parse(Body.java:260)
Resolution
UTF-8 encoding can be set for the API Gateway if not the default.In a UNIX environment:
$ env | grep UTF
LANG=en_US.UTF-8
GDM_LANG=en_US.UTF-8
If not already UTF-8 set it with a command similar to below with any local language variant: e.g.
$ export LANG=en_US.UTF-8
For the JRE add the attached jvm.xml in the
Gateway_install/conf directory:
It contains the following line
<VMArg name="-Dfile.encoding=UTF-8" />
If there is already a jvm.xml located in the API Gateway_install/conf directory simply add the line above between the <ConfigurationFragment> nodes.
Restart the API Gateway.