简体   繁体   English

如何在unitils / DBunit中执行UTF-8脚本

[英]How execute UTF-8 scripts in unitils / DBunit

I wrote all SQL scripts for tests using UTF-8. 我使用UTF-8编写了用于测试的所有SQL脚本。 All my java code uses UTF-8 charset. 我所有的Java代码都使用UTF-8字符集。 When I tried execute the tests, the unitils/DBunit read them as other encoding (maybe ISO 8859-1). 当我尝试执行测试时,unitils / DBunit会将它们读取为其他编码(也许是ISO 8859-1)。

My database is ORACLE. 我的数据库是ORACLE。 I tried set 'NLS_LANG=AMERICAN_AMERICA.UTF8' in my enviroment. 我尝试在我的环境中设置“ NLS_LANG = AMERICAN_AMERICA.UTF8”。 This setting works in sqlplus, but, no effect in DBunit execution. 此设置在sqlplus中有效,但对DBunit执行无效。

Anyone knows how to resolve this? 有人知道该如何解决吗?

I resolved this issue adding this VM parameter in java command: 我解决了在Java命令中添加此VM参数的问题:

-Dfile.encoding=UTF-8

Sergio Marcelo 塞尔吉奥·马塞洛(Sergio Marcelo)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM