zoukankan      html  css  js  c++  java
  • idea tomcat的控制台输出乱码,还有web工程的网页输出乱码

    idea tomcat的控制台输出乱码,还有web工程的网页输出乱码

    (彻底解决乱码问题)

    1,小知识~判断乱码原因(可以直接跳过):

    ■   判断乱码的形状:

    □ 还能看出是某个字,感觉像繁体字的:可能原因是utf8解析gbk

    □ 直接是一坨的:可能是gbk去解析utf8

    2,解决乱码:第一种情况~~控制台乱码~所有的编码方式都给同一为 utf-8

    □ idea 编码设置:(记得全局设定哈)

    1,idea 软件中设置:File -》New Projects Settings -》 Settings for New Projects -》 Editor -》File Encodings -> 分别设置一下

    全局编码方式(Global Encoding)设置为utf-8;

    工程编码方式(Project Encoding)设置为utf-8;

    默认配置文件编码方式(Default encoding for properties files)设置为utf-8;

    2,idea 安装目录bin 下的设置(顺便解决了JAR包里面的中文输出乱码),

    分别在idea.exe.vmoptions、idea64.exe.vmoptions 中最后的位置加入:

    -Dfile.encoding=UTF-8
    -Dconsole.encoding=UTF-8

    □ tomcat 编码设置:(进入tomcat的配置文件conf/logging.properties)

    1,在tomcat的logging.properties 文件中~ 将所有哦编码方式都设置为 utf-8

    ~~~直接在logging.properties 文件中 按ctr+F,输入encoding 进行查找

    2,在idea 中 tomcat的配置中,Run -》Edit Configurations -》Tomcat 的Server下 VM options 输入:-Dfile.encoding=UTF-8

    最后~~~重启一下idea啦

    2,解决乱码:第二种情况~~部署在tomcat的web工程网页乱码

    解决:书写web页面的代码进行设编码方式,例如:

      //出现乱码了,就设置一下编码方式
       response.setCharacterEncoding("utf-8");

    参考:

    https://blog.csdn.net/qq_38188047/article/details/111031987 《idea tomcat的server输出乱码以及控制台输出乱码,log乱码。终于解决了!》

  • 相关阅读:
    Codeforces467C George and Job
    Codeforces205E Little Elephant and Furik and RubikLittle Elephant and Furik and Rubik
    Codeforce205C Little Elephant and Interval
    51nod1829 函数
    51nod1574 排列转换
    nowcoder35B 小AA的数列
    Codeforce893E Counting Arrays
    gym101612 Consonant Fencity
    CodeForces559C Gerald and Giant Chess
    CodeForces456D A Lot of Games
  • 原文地址:https://www.cnblogs.com/shan333/p/15294324.html
Copyright © 2011-2022 走看看