How to store the Chinese characters on the webpage to the end of the database

zhaozj2021-02-16  60

The code in the input box in the web page is ISO-8859-1, while the default code in the MSSQL database is GB2312 so it needs to be converted, but after the conversion, when the character is converted to GB2312, on the web page It is garbled when it is displayed, but it is not garbled in the web page when reading from the database, and it doesn't need to be converted again, when comparing (for example: verifying user login), the code in the input box is ISO-8859-1, need to be converted to GB2312, and the database does not need to be converted, it can be directly compared. com.microsoft.jdbc.sqlser.sqlserverdriver jdbc: Microsoft: SQLServer: // localhost: 1433; sendStringParametersasunicode = true sa < PWD> xzy MySQL database default code is GB2312, but characters in the input box in the web page cannot be re-encoded and stored directly, re-coding is garbled in the database, displayed is not garbled, but When reading data from the database, ISO-8859-1 should be converted to GB2312 if you need to compare them with strings in the input box in the input box, you should convert them from ISO-8859-1 to GB2312 Whether they are in a web page or in a database. This will be successful, and it is not garbled when it is output to the web page again. My database is connected to org.gjt.mm.mysql.driver jdbc: mysql: // localhost / classmate? root xzy My page's default code is GB2312 without encoding, using default encoding. Give me: mailto: xzy_love@163.com

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

New Post(0)