Reputation: 85
I was trying to rewrite an XML file that was originally encoded as ISO-8859-1
.
When I tried to print the output, it was giving me garbled letters. Can someone pls help how to solve this issue?
someFile.xml (make sure file is saved in ISO-8859-1 encoding)
<?xml version="1.0" encoding="ISO-8859-1"?>
<text>å bestå gjennom fem århundrer også tålt</text>
test.feature
* def xmlData = karate.read("someFile.xml")
* karate.log(karate.prettyXml(xmlData))
Output:
<text>� best� gjennom fem �rhundrer ogs� t�lt</text>
I've made sure that my pom.xml is using ISO-8859-1 encoding
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<argLine>-Dfile.encoding=ISO-8859-1</argLine>
</configuration>
</plugin>
Upvotes: 1
Views: 473
Reputation: 58058
Internally Karate is biased towards UTF-8. So far this hasn't been an issue.
I suggest two options:
Also see: https://stackoverflow.com/a/54593057/143475
Upvotes: 2