How set encodings in Jenkins to UTF-8

2020-02-12 08:44发布

问题:

Cyrillic symbols in the Console output are not displayed correctly. Jenkins is running through Tomcat / 8.5.11 on Windows 7
The Jenkins property displays:
file.encoding Cp1251
sun.jnu.encoding Cp1251
sun.stderr.encoding cp866
sun.stdout.encoding cp866

How can I set the encoding on UTF-8 in Jenkins? Encoding in autotest code is UTF-8.
It is example problem in Cyrillic text
_максимум_информации

SOLVED: I created file setenv.bat in bin folder and set JAVA_OPTS="-Dfile.encoding=UTF-8"

回答1:

According to this answer: JVM property -Dfile.encoding=UTF8 or UTF-8?

You have to add this JVM setting to your Jenkins starting script (JAVA_TOOLS_OPTIONS):

-Dfile.encoding=UTF8


回答2:

I created file setenv.bat in bin folder and set JAVA_OPTS="-Dfile.encoding=UTF-8"