Chinese solution in JSP / servlet
Java's Chinese issues have always been very headache. Perhaps because there are Chinese many character sets.
Here we first say the Question of Servlet.
As we all know, servlets need to be pre-compiled and have to talk about Java compilation.
Java content is to use Unicode character sets. So you can basically provide support for most languages (of course, if you will be a particularly uncommon language, Java is not necessarily supported), so relatively, Java support is quite good for multi-language support, or even you can With the Chinese class name and the Chinese method name, the compilation and running is also no problem. However, most operating systems are not all supporting Unicode, at least Javac defaults to compile using the character set of the system, for example, if your operating system is Chinese Win2k, then your default character set is GBK If you use Japanese Win2K, then your default character set is MS932. Javac defaults to call the system's character set to compile, that is, the Encoding parameter in Javac is the default product set. I know this problem is easily solved. If your program contains characters that are not supported by the current system default character set, you need to make your character set to compile. However, occasionally there will be some problems, but this is not a problem with Java. Just taking the notepad, if you use the Notepad to write a program, you will use Notepad's default ANSI character encoding mode to save. This situation is also likely to result in garbled production, so it is best to develop his encoding mode while using IDE.
Now talk about JSP issues.
This processes are relatively simple, as long as you specify similar to% @ page language = "java" on the page, there is basically no problem. Also need your IDE to develop a character encoding to avoid garbled problems.
The above is simple to solve the problem of Chinese garbled. But I personally think this is not a best solution, because you are also subject to the restrictions of the character set of the system and IDE, and it is easy to have problems when implementing cross-platform. I have to accept a method of appreciation, maybe this method is now already used.
I recommend using the Properties file to save the corresponding text information, so there is the following advantages:
1. You can replace text very flexibly to implement multilingual interfaces.
2. Can avoid garbled problems fundamentally
The first point I don't say everyone can experience it. Keep the second point.
The JDK comes with a NACTIVE2ACSII command, this command is converted to the ASCII character.
The current not all operating systems support unicode or other character encoding, but it is supported according to what I know is supported for the ASCII code, so we can turn our text into an ASCII code. This function can be achieved by NACTIVE2ACSII. This program is under Java_Home / BIN. You can test it yourself.
Copyright
Ibeyond
All, you may pass
http://www.ibeyond.org
Get more information,
You can also pass 9cbs@ibeyond.org
Contact me.