Oracle Database query is not garbled, and data garbled characters are displayed on the web end, oracleweb
Recently, we migrated a project from our company, oracle deployed on one linux server, and web project deployed on another linux server. However, after the project deployment is complete, the returned data is garbled. The local database connection query shows no garbled characters, but the web query shows garbled characters, the problem basically occurs on the web end. It should be a character set problem.
1. First view the oracle database character set select * from nls_database_parameters; display the ZHS16GBK encoding format used by oracle.
2. Check whether the encoding format of the tomcat server is GBK. Then there is no problem with database query and server encoding, so the problem is only caused by the linux environment encoding problem. Linux has two configuration encoding parameters: LANG and NLS_LANG.LANG is used to set the language, region, and Character Set of the Linux system. It is valid for linux applications, such as date. NLS_LANG is used to set the Oracle language, region, and character set, valid for oracle tools.
Shut down the tomcat server, and execute the following statement before starting
Export LANG = zh_CN.GB2312
After the execution, restart tomcat to solve the problem.