Jenkins console encoding issue with Postman even If i add UTF-8

96 views Asked by At

jenkins console1

When I tried to execute my postman collection using newman on Jenkins, the console output wasn't readable.
I did some research about it and I found out that I should add the UTF-8 setting in the jenkins.xml file. After I did that, most of the output was readable but the result table at the last part.

jenkins console2

After hours of research, still couldn't add a solid solution. I thought it was about the coloring, and I even added to --color off. Still the same. Is there any solution?

I tried to add utf-8 encoding settings, it worked for most of the output but the last part. And disabled coloring with --color off but still, I can't get the table view on console output

1

There are 1 answers

3
VonC On

For testing, add the Jenkins ANSI Color Plugin: it adds support for standard ANSI escape sequences, including color, to Console Output.

That should help for your second image, for the output of the table at the end of the Newman execution in the Jenkins console.


I installed Jenkins ANSI Color Plugin and followed these steps:

  1. open cmd with admin auth
  2. net jenkins stop
  3. net jenkins restart

So I basically restarted manual from cmd and built the same project again and still the same output.
But I noticed that I ran the test with cmd and also ticks (pass) and a lot more colored but these are also visible at jenkins with no color. Only last board part is not visible and I assume it's something about table lines but not sure.

The ANSI Color Plugin should help with interpreting color codes, but it seems the issue is specifically with the characters used to draw tables by Newman. The plugin might not support all Unicode characters used for drawing tables, or there might be a configuration issue.

Make sure the ANSI Color plugin is configured correctly in your Jenkins job. In your job configuration, you should find a section to enable color ANSI console output. Select the proper ANSI color map that matches your terminal's capabilities.

Make sure you are using a Newman version that supports non-Unicode output. See postmanlabs/newman issue 1558, which mention the options --disable-unicode --no-color

newman run collection.json --disable-unicode  --no-color

I suppose you already added -Dfile.encoding=UTF-8 to the Jenkins startup parameters. But make also sure the Jenkins console output encoding is set to UTF-8. That can sometimes be different from the system encoding and can be set in the Jenkins UI under Manage Jenkins -> Configure System -> Global properties -> Environment variables.

If everything else, you might, as a workaround, consider using a custom script to parse and replace the problematic characters in the output before it is displayed on Jenkins. That can be a simple sed or awk command that processes the output of Newman and replaces non-ASCII characters with ASCII equivalents.

Check also and compare the raw output of the build log with what is shown in Jenkins. The raw build log is typically available at:

[JENKINS_HOME]/jobs/[job-name]/builds/[build-number]/log

As a last resort, if the Jenkins console is not displaying the table correctly, you could output the results to a file and then publish that file as a build artifact, or display its contents as a post-build step using the cat command or a similar utility.