Karate 空手道DSL:读取json文件时无法转换不同语言的字符串

Karate 空手道DSL:读取json文件时无法转换不同语言的字符串,karate,Karate,我试图用json文件匹配整个响应 Background: * url BaseURL * def resp = read('response_get_discount.json') // Reading json file Scenario: Verify Users discount Given path '/discount' When method get Then status 200 * match response =

我试图用json文件匹配整个响应

    Background:
    * url BaseURL
    * def resp =  read('response_get_discount.json') // Reading json file

   Scenario: Verify Users discount
    Given path '/discount'
    When method get
    Then status 200
    * match response == resp //Trying to match whole response with the output of the above json file
问题:

我的json文件在西班牙有以下输出:

    {
    "familyCode": "DH",
    "validityStart": 1575500400000,
    "description": "Aparamenta modular Limitadores sobretensiones + Gestión Energía  (SPD + CCB)"
}
请注意单词“Gestión Energía”,当它从文件中读取时,它将被转换为“Gesti”�n能量�a”。 因此,它无法与response vs resp匹配


有没有办法忽略或处理这些编码字符?

请阅读文档中的这一部分:

解决方案是确保在运行空手道测试时,将JVM file.encoding设置为UTF-8。这可以通过maven surefire插件配置完成。将插件添加到pom.xml的
/
部分(如果尚未提供):


org.apache.maven.plugins
maven surefire插件
2.10
-文件编码=UTF-8
编辑:这是一个文件编码问题-请参阅注释


我已经按照你的建议想出了解决办法。因为我使用的是eclipse,所以我执行了以下步骤来正确编码json。Windwos—首选项—常规—工作区:在文本编码下,选择其他项—UTF-8。应用并重新启动ecplise


谢谢你的快速回复。我将上面的插件添加到POM中,但仍然没有成功。我仍然可以在eclipse控制台中看到UNICODE字符。不确定我做错了什么。@WilD_Ping是时候让我向您指出这个过程了:谢谢您的时间!我真的很感激你对帮助人们解决问题的奉献精神。我已经提交了一个问题@WilD\u Ping对不起-该项目无法使用。请提供有关如何运行和复制的步骤。我已根据您的建议找到修复方法。因为我使用的是eclipse,所以我执行了以下步骤来正确编码json。Windwos—首选项—常规—工作区:在文本编码下,选择其他项—UTF-8。应用并重新启动ecplise。
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.10</version>
    <configuration>
        <argLine>-Dfile.encoding=UTF-8</argLine>
    </configuration>
</plugin>