无法在 SOAP UI 中使用 Groovy 打印或记录非英语字符串,例如阿拉伯文、中文字符

Unable to print or Log non english strings e.g arabic,chinese characters using Groovy in SOAP UI

以下是我的代码,我想从响应中断言此文本。我正在读取由阿拉伯文和中文字符串组成的文件内容

文本文件的格式是

10911= الأصول مع تعريب
10912= الأصمع تعريب

Groovy代码如下

Properties properties = new Properties()
def file = new File(''C\properties.txt'))
InputStream is = new ByteArrayInputStream(file.getBytes());
properties.load(is)
log.info  properties."10911".toString()

获得响应

اÙ?أصÙ?Ù? Ù?ع تعرÙ?ب

如何在soapui中用阿拉伯文或中文登录

转到 soapUI 中的 file/Preferences

HTTP Settings Response compression 中必须取消选中。

从 UTF-enabled 加载 Properties Reader:

Properties properties = new Properties()
def file = new File('C:\properties.txt'))
file.withReader('UTF-8') { properties.load(it) }
log.info(properties."10911".toString())