Chinese shows garbled! (Continuously added ...)

zhaozj2021-02-16  94

Just started learning JSP, I met Chinese garbled, I saw a lot of posts on 9CBS, a little low inspiration, but the problem solved.

Today is to touch the page pass value, and the problem that shows Chinese appearance.

------------------------------

The information transmission between the servers is ISO8859_1 and the browser display is GB2312 when using getParameter (), it is the information transmitted between the servers so it is to specify the encoding, which is GetBytes ("ISO8859_1") and then used to display Therefore, it is necessary to convert to GB2312 so string s = new string (getParameter ("xxxx"). GetBytes ("ISO8859_1"), "GB2312"); ---------------------------------------------------------------------------------------------------------------------- ----------------

I have learned a lot of stuff. I have seen a lot about Chinese display garbled problems, involving database operations, hey, only because of yourself

Too cuisine, have not been contacted. But you must also post it, you can use it later.

------------------------------------ Use JDBC to connect to the MySQL database, the connection string is changed: String URL = "JDBC: mysql: // server / tzw? useunicode = true & characterencoding = GB2312"

This method, <% Request.SetCharacterencoding ("GBK");%> ------------------------------- ----

Chinese garbled display causes may also involve OS, JDBC Version, DBMS ...

learning...

转载请注明原文地址:https://www.9cbs.com/read-11662.html

New Post(0)