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


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\ warning: unmappable character for encoding Cp1252

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


Best Regards,

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

Comment actions Permalink


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
"Develop with pleasure!"

Comment actions Permalink

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?

Comment actions Permalink

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:

Hope this helps,


Please sign in to leave a comment.