How to Fix Jenkins Console Log Encoding Issue on Windows

If you get alien characters in console log of your job like this:

Newman’s Output in Jenkins Console Log

Then you have a problem with Java file encoding issue. Refer to this thread on StackOverflow, you need to add java argument -Dfile.encoding=UTF8 when running Jenkins with java command.

But in Windows, this is not straightforward when you install Jenkins as a Windows services.

Windows Service Wrapper

To run Java application as a Windows service, you cannot run it directly using java command but you need a wrapper. Jenkins uses WinSW as a services wrapper to run java and jenkins.war.

Per its documentation, you can specify Java argument in the XML config file i.e. jenkins.xml, like this:

-Dfile.encoding=UTF8
Editing Jenkins’ WinSW XML Config File

Now, you can see nicely character in console log. Cheers!

Jenkins Console Log Output with Correct Encoding