How to solve the problem of garbled Web server program-related skills
Source: Internet
Author: User
Use PHP to define the default language for PHP.
In php.ini:
Default_charset = "gb2312"
export Chinese in a Web page
Java is used in the network transmission code is "iso-8859-1", so the output needs to be transformed, such as:
String str= "Chinese";
Str=new String (str.getbytes ("GB2312"), "8859_1");
However, if you are compiling the program with the encoding "GB2312" and running this program on the Chinese platform, you must be aware that this problem does not occur.
reading Chinese from parameters
This is exactly the opposite of the output in the Web page:
Str=new String (str.getbytes ("8859_1"), "GB2312");
manipulating the Chinese issues in DB
A simpler approach is to set the area to English (United States) in Control Panel. If there will be garbled, you can also set the following:
When taking Chinese: str=new String (Str.getbytes ("GB2312"));
Enter Chinese in DB: Str=new String (Str.getbytes ("iso-8859-1"));
in the JSP in the Chinese solution:
In Control Panel, set the area to English (United States).
In the JSP page, add:
<%@ page contenttype=text/html; CHARSET=GBK%>
If the display is not working correctly, the following conversions are also performed:
such as: Name=new String (Name.getbytes ("iso-8859-1"), "GBK");
There won't be any Chinese problems.
Chinese questions in asp.net:
Adding the following code to the Congfig file will solve the problem of passing values to Chinese parameters between pages.
<globalization fileencoding= "gb2312" requestencoding= "gb2312" responseencoding= "gb2312" culture= "ZH-CN"/>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.