IDEA garbled summary and processing

Engineering garbled

Open File-Setting, File Encodings find this option, set the encoding to encode your project, usually UTF-8, as shown below (red box in place), and then rebuild it again, basically on the line

The implementation of the main function, the console garbled

Also open setting, find Build, Execution, Deployment> Compiler> Java Compiler, set the Additional command line parameters option -encoding utf-8, and then the next rebuild, re-run

When you run tomcat, console garbled

1) Open the Run / Debug Configuration, select your tomcat

 

 

 2) Then Server> VM options to -Dfile.encoding = UTF-8, restart tomcat

supplement:

tomcat configuration file: In tomcat / conf directory, set logging.properties

Other garbled

Whether 1) Database garbled data

  View database encoding type

show variables like ‘character%’
character_set_client    utf8
character_set_connection    utf8
character_set_database  utf8
character_set_filesystem    binary
character_set_results   utf8
character_set_server    utf8
character_set_system    utf8
character_sets_dir  /aebiz/soft/mysql/share/charsets/

2)jsp乱码

  查看代码中是否添加下面代码

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

3)request和response

request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");

 

 

参考:

1、https://blog.csdn.net/u012611878/article/details/80723491

2、https://www.cnblogs.com/shej123/p/10312806.html

Guess you like

Origin www.cnblogs.com/116970u/p/11593126.html