How to Fix Jenkins Console Log Encoding Issue on Windows

Chairat Onyaem
Oct 2, 2017 · 2 min read
Image for post
Image for post

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

Image for post
Image for post
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
Image for post
Image for post
Editing Jenkins’ WinSW XML Config File

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

Image for post
Image for post
Jenkins Console Log Output with Correct Encoding

Chairat.me

Personal blog of a developer who passionate in new…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store