控制台中文乱码

检查思路

  1. 系统环境变量,如果是POSIX,需要修改成utf8,zh或者us都行

    # locale
    # locale-gen en_US.UTF-8
    # tail -3 /etc/profile
    PATH=$PATH:$ANT_HOME/bin
    export LANG="en_US.UTF-8"
    export LC_ALL="en_US.UTF-8"
    
  2. 修改启动文件,增加java运行参数-Dfile.encoding=UTF-8,需要补充的是,安装方式不同要修改的运行参数文件路径也不同,所以要先自己灵活变通下

    # root@daea203b8570:/var/lib/jenkins# grep "JAVA_ARGS" /etc/default/jenkins 
    JAVA_ARGS="-Djava.awt.headless=true"  # Allow graphs etc. to work even when an X server is present
    JAVA_ARGS="-Dorg.apache.commons.jelly.tags.fmt.timeZone=Asia/Shanghai -Dfile.encoding=UTF-8"
    #JAVA_ARGS="-Xmx256m"
    #JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address
    
  3. 修改完之后重启Jenkins,老的build输出还是乱码,不过新的build输出就可以看到中文了

results matching ""

    No results matching ""