单元测试输出中的错误编码

Wrong encoding in unit test output

在 Android Studio 1.4 on Windows 10 中,我正在使用 TestNG 为我的应用程序编写单元测试。

当我 运行 我的单元测试时,输出 window 显示:

java.lang.AssertionError: 
Expected :ʼ�aluū
Actual   :ʾ�aluū

我已经将每个编码设置更改为 UTF-8,并且还在 Java 命令行中添加了 -Dfile.encoding=UTF-8。但是命令的输出仍然被读回为 ISO-8859-1。

如何才能从单元测试中获得正确的输出?

我在 http://tools.android.com/tech-docs/configuration 上找到了解决方案。

我刚刚在正确的文件夹中创建了一个文件 studio64.exe.vmoptions 并添加了这一行:

-Dfile.encoding=UTF-8