Unified use utf-8 Encoding
The coding format of the database is also utf-8

For pages post There's no garbled code coming in

For pages get Pass the value to solve the garbled code
Method 1 : At the business level :userName = new String(userName.getBytes("iso-8859-1"),"utf-8");
Method 2 :
First in jsp Page :
userName = encodeURL(userName,"UTF-8");
userName = encodeURL(userName,"UTF-8"); Twice according to utf-8 Coding is equivalent to URLDecoder.encode(userName,"UTF-8");
And then the business layer :userName = URLDecoder.decode(userName,"UTF-8");
Method 3 : It's all about dealing with random code
userName = URLDecoder.encode(userName,"UTF-8");
userName = URLDecoder.decode(userName,"UTF-8");

solve web More related articles about garbled in

  1. web The garbled code processing in

    1 .web Chinese garbled code processing in 1. Page setup pageEncoding="UTF-8" <%@ page contentType="text/html;charset= ...

  2. How to solve WEB Application of Chinese garbled problem

    The most common scenario is when the browser sends a request to the server , The solution is to force the encoding format for requests and responses . One .POST Way request garbled 1. At every Controller It's handled separately request.setCh ...

  3. 15、 ... and 、web Summary of dealing with garbled code in

    One .jsp The way to become --- Chinese garbled jsp In the transformation of Servlet The process of encoding is transformed three times : from   http://www.cnblogs.com/chenssy/p/4235191.html Two .java ...

  4. javabean solve jsp Chinese and Chinese code disorder

    Problem description :useBean Behavior defines Java Bean object (Person Class includes names [string], Age [int]), Use html Page to JSP Page submit data ,JSP Page usage Java Bean Behavior to deal with ...

  5. How to solve JSP There is a garbled problem in the process

    First of all, let's understand the cause of the problem . The general situation is in every JSP There is a statement at the head of the page : This statement determines the use of GB2312 Coding form , And in the database is generally used iso-8859-1 Character sets store data . and Java Program ...

  6. solve Metasploit in shell The problem of disorderly code

    We are kali of use Metasploit Get windows The host shell after , There will be a mess , In the final analysis , Namely windows and linux The Chinese coding of the system is different , So lead to windows The Chinese on the system is lin ...

  7. solve html The confusion in

    1. The easiest way to be rude is to add meta label , But it's worth noting that our meta The label is related to our head Labels are at the same level , So never put meta The label is added to our head In the label . <meta http-e ...

  8. How to solve idea The garbled code itself and solving the garbled code in the code ?

    1: solve idea Garbled in the console (3 Medium method ): The first one is : As shown in the picture, we need to find idea Installation path for : idea\IntelliJ IDEA 2018.3.2\bin Under this path is a file called :idea64. ...

  9. mysql Chinese and Chinese code disorder

    effect : Constraints are used to ensure the validity and integrity of data . Define primary key constraints Primary key constraint primary key : A field of information record can uniquely distinguish other information records , This field can be the primary key ( only Non empty )   primary key ...

Random recommendation

  1. Searching for a valid kernel header path... The path &quot;&quot; is not a valid path to the ***** kernel headers. Would you like to change it? [yes]

    stay centos 6.5 install vmtools When , Unzip the package ,mount After mounting , install pl Report in the process This problem , It hasn't been solved for a long time ,google And then I found out that's it I installed the kernel-deve ...

  2. IOS The next day multithreading -05NSOperationQueue Pause , And recovery queue tasks

    *********** #import "HMViewController.h" @interface HMViewController () <UITableViewDel ...

  3. Execute... With parameters sql character string

    -- Parameters to pass in declare @Rv NVARCHAR(40) -- To execute with parameters sql character string declare  @sql nvarchar(max) set @sql='select * fr ...

  4. CentOS User authority management --su And sudo

    Linux Rights management --su And sudo 1.su Used to switch login users , For example, the current user is chen, It can be used su zhu, And enter the user zhu Login password for , You can switch to the user zhu. If a normal user wants to switch to root user , ...

  5. Appium Android Bootstrap Control source code analysis AndroidElement

    In the last article <Appium Android Bootstrap A brief introduction to source code analysis > We are right. bootstrap The definition of and its role in appium and uiautomator What kind of position do you have ...

  6. C Language EOF

    Validation expression getchar()!=EOF The value of is 1 still 0 Write a print EOF Value program   windows Next is ctrl-z Namely ctrl and z Press together , It's the terminator linux Next is ctrl-d Is the terminator . This is a ...

  7. self-taught Linux Shell9.2- be based on Red Hat There are two ways to build a system toolkit :RPM package

    Click on the return   self-taught Linux Command line and Shell The script road 9.2- be based on Red Hat There are two ways to build a system toolkit :RPM package This section is mainly based on Red Had The system of ( The test system centos) 1. There are two ways to build a toolkit ...

  8. Bootstrap Popover

    [Bootstrap Popover] 1. Set up a popover You need to add the following settings : 1)data-toggle="popover" 2)title="Example p ...

  9. string Type version number comparison

    Go straight to the code : boolean CompareVersion(string softVersion1, string softVersion2) { ) { return true; } return ...

  10. nginx stay windows Notes under the platform

    nginx It mainly provides reverse proxy and load balancing capabilities , Redirection message proxy and message data replacement are also common functions .( Reference resources https://www.cnblogs.com/fanzhidongyzby/p/5194895.html) ...