Jenkins: console output characters

2020-02-10 03:26发布

问题:

Does anyone know how to beat such chars in Jenkins console output log?

Seems there is a problem with UTF-8.

回答1:

The issue here is that the characters are not being output as UTF-8 to your console. I think the solution is to tell jenkins when you invoke it to write output as UTF-8. See this solution for a similar problem UTF-8 char encoding does not work on console (Linux)

Something like java -Dfile.encoding=UTF-8 jenkins.war might do the trick



回答2:

In Jenkins ver. 2.46.2, I just got this to work by going to Nodes, Advanced settings, JVM Options and putting -Dfile.encoding=UTF8 and then taking that node offline and online again. Hope this helps other people. It would be great if UTF8 support was default.



回答3:

To give the the answer more complete. If you use an tomcat container to run jenkins, then edit catalina.sh config file:

vim apache-tomcat-path/bin/catalina.sh

Add -Dfile.encoding=UTF-8 to the JAVA_OPTS var and restart tomcat will do the trick.