java 如何将 Jenkins 中的编码设置为 UTF-8
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46112011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How set encodings in Jenkins to UTF-8
提问by Denis Bolshakov
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
控制台输出中的西里尔符号未正确显示。Jenkins 在 Windows 7 上通过 Tomcat / 8.5.11 运行
Jenkins 属性显示:
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
_Р?Р°Р?С?РёР?С?Р?_РёР?С?Р?С?Р?Р°С?РёРё
如何在 Jenkins 中设置 UTF-8 编码?自动测试代码中的编码是 UTF-8。
这是西里尔文中的示例问题
_Р?Р°Р?С?РёР?С?Р?_РёР?С?Р?С?Р?Р°С?РёРё
SOLVED: I created file setenv.bat in bin folder and set JAVA_OPTS="-Dfile.encoding=UTF-8"
已解决:我在 bin 文件夹中创建了文件 setenv.bat 并设置了 JAVA_OPTS="-Dfile.encoding=UTF-8"
采纳答案by Denis Bolshakov
I created file setenv.bat in bin folder and set JAVA_OPTS="-Dfile.encoding=UTF-8"
我在 bin 文件夹中创建了文件 setenv.bat 并设置了 JAVA_OPTS="-Dfile.encoding=UTF-8"
回答by Bruno Lavit
According to this answer: JVM property -Dfile.encoding=UTF8 or UTF-8?
根据这个答案: JVM property -Dfile.encoding=UTF8 or UTF-8?
You have to add this JVM setting to your Jenkins starting script (JAVA_TOOLS_OPTIONS):
您必须将此 JVM 设置添加到您的 Jenkins 启动脚本 (JAVA_TOOLS_OPTIONS):
-Dfile.encoding=UTF8