I am very annoyed by the Chinese issue of struts resource files. How can I make the quotas Chinese ??? Or some of the documents you cannot understand. Let's not talk much about it. Let's look at the following key points:
There are three main problems:
1. If the value in struts Chinese source files is Chinese, garbled characters are displayed.
Solution: Use the Eclipse plug-in properties Editor
Update site http://propedit.sourceforge.jp/eclipse/updates/ (recommended for automatic updates)
Steps:
Find and install help/software updates/Under Eclipse/select second/new remote site/name random write URL input http://propedit.sourceforge.jp/eclipse/updates/
2. Enter Chinese characters in the text field to display garbled characters
Solution: Use the servlet Filter
You can use filters. setcharacterencodingfilter under tomcat to add the corresponding servlet_examples configuration in tomcat in your web. xml configuration. (You can configure them yourself !)
The configuration is as follows:
Setcharacterencoding
Filters. setcharacterencodingfilter
Encoding
GBK
Setcharacterencoding
*. Do
3. Read garbled characters from some databases
Solution: recode the part you want to display as Chinese
For example, while (Rs. Next ())
{
String col1 = Rs. getstring (1 );
String col2 = Rs. getstring (2 );
String col3 = Rs. getstring (3 );
Float col4 = Rs. getfloat (4 );
// Convert character encoding
Col1 = new string (col1.getbytes ("ISO-8859-1"), "gb2312 ");
Col2 = new string (col2.getbytes ("ISO-8859-1"), "gb2312 ");
Col3 = new string (col3.getbytes ("ISO-8859-1"), "gb2312 ");
}