Nicolas Siver
Nicolas Siver

Reputation: 2885

Jenkins: console output characters

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

Seems there is a problem with UTF-8.

Console output

Upvotes: 23

Views: 34747

Answers (7)

Olga Anastasiadou
Olga Anastasiadou

Reputation: 143

Try using AnsiColor plugin in Jenkins. This worked for me. I had tried all the above solutions but nothing happened. As I downloaded AnsiColor plugin everything got fixed!

Upvotes: 0

J. Allen
J. Allen

Reputation: 660

For those who are using a build-agent and a pipeline, add this to the agent's dockerfile, and no further jenkins settings are needed

ENV JAVA_TOOL_OPTIONS -Dfile.encoding=UTF-8

Upvotes: 2

Mauricio
Mauricio

Reputation: 621

I've tried everything with file.encoding variable, but didn't work.

My solution was to check environment locale variables in Jenkins Controller and Agent node where job is actually runing, and make them match.

In my case, agent node running the job required environment variable "LC_ALL=C.UTF-8", which was already defined in controller node.

More details here: https://stackoverflow.com/a/68217405/3284482

Upvotes: 1

Tanish Saxena
Tanish Saxena

Reputation: 1

Try to change the encoding with you are opening your file to 'utf-8' and check your encoding saved for the script in vs code(whatever platform) enter image description here

Upvotes: 0

Julian Burgess
Julian Burgess

Reputation: 705

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.

Upvotes: 9

mainframer
mainframer

Reputation: 22089

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. enter image description here

Upvotes: 3

Sam Mikes
Sam Mikes

Reputation: 10828

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

Upvotes: 17

Related Questions