How to set file.encoding, since it is by defaut is Cp1252

Hi,

Most test cases are failed during running by teamcity and the fail reason is assert failure (actual result is not equal with the expected. They can actually pass if run by ant in command line)

Checking the following build log, I found encoding may be the reason cause those test failure, and I found the agent has “Additional properties defined by JVM and agent runtime” in which file.encoding =CP1252, so is it possible for me to adjust “file.encoding” to pass my tests?
Build log:

: C:\cps_build\manager\test\com\emc\cma\cps\services\LPLocalFunctionalTest.java:99: warning: unmappable character for encoding Cp1252

: String content = "中å?Žäººæ°‘共和国是一个历å?²æ‚ 久的国家,人å?£ä¼—多,物产富饶,有ç?€56个民æ—?, 5000多年的文明å?²ã€‚";

:

Best Regards,
Yolanda

Edited by: Hu Yewen on Jun 19, 2008 6:00 AM

3 comments

Hello,

It seems that TeamCity is not directly connected with the issue you are experiencing.

Most probably the environment is different when you run your tests from the command line and from TeamCity.
You can find the actual command line executed by TeamCity in the "logs/teamcity-agent.log" file on the agent. Please check for specific properties that are not passed by TeamCity, but present when you run your build from the command line.

If you are running the agent as a service, you can try running it via agent.bat file instead (under the same user that the build passes OK).

If you use Ant runner, you may have some properties defined in the ANT_OPS environment variable. To be available in TeamCity, you may need to specify the options in the "JVM command line parameters" field.

--
Best regards,

Yegor Yarko
Project Manager
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

Hi Yegor,

I check the agent log and found:
INFO - nt.runner.GenericProgramRunner - "C:\Program Files\Java\jdk1.5.0_11\bin\java.exe" "-Dteamcity.buildConfName=CPS jUnit" "-Dfile.encoding=Cp1252

So I clearly specific the -Dfile.encoding=utf8 during config teamcity ant runner JVM parameter, but it doesn't work, the junit tests always failed with assert failure.

Can you give me some further inspiration about it?

0

I suppose you should pass source.encoding system property to the build.
The most consistent way for that - simply add ]]> to your build script.

Or add system property in TeamCity:
http://www.jetbrains.net/confluence/display/TCD3/6.Propertiesandenvironment+variables

Hope this helps,
KIR

0

Please sign in to leave a comment.