From: leaf blog http://www.cnal.com.cn/blog/
Solve Chinese garbled characters when Ajax uses get to obtain data in the netbox Environment
2007-1-31 10:20:39
[Gyct] A web system developed for the customer was originally planned to run under IIS, but the client's computer operating system IIS could not be installed either way, I cannot ask the customer to reinstall the operating system for this web system? So I thoughtNetbox.
During development, debugging is performed under IIS and then run with netbox. Basically, everything works normally. After a period of time, the customer proposes to add a new function, as a result, a new function is added with Ajax. An error occurred while running in netbox,
Error message:
Runtime error '800a01b6'
The object does not support this attribute or method: 'response. charset'
---------------------------------------------------------------------
(Baidu, there are still many people who encounter the same error)
Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'response. charset'
Check error code:
Response. charset= "Gb2312"
This line of code is mainly used to solve the problem of Chinese garbled characters when Ajax obtains data using get.
After this line of code is deleted, netbox runs normally, but Chinese data returned by Ajax becomes garbled.
DescriptionNetbox does not support response. charset.
Open the netbox user manual and expand it one by one:
Object Reference → response object → RESPONSE METHOD
Addheader Method
The addheader method adds the HTML title with the specified value. This method often adds a new HTTP title to the response.
Syntax
Response. addheader name, Value
Parameters
Name
Name of the new title variable
Value
Initial values stored in the new title variable
Note
To avoid ambiguous names, the name cannot contain any underscore (_). The servervariables set interprets the underline characters in the title as a backslash. For example, the following script allows the server to search for a title named my-header.
<% Request. servervariables ("http_my_header") %>
Example
The following example uses the addheader method to require the client to use basic verification.
<% Response. addheader "www-authenticate", "Basic" %>
Note that the preceding script only notifies the client browser of which verification is used. If you use this script in a web application, you must enable basic verification for the Web server.
Therefore
Response. charset = "gb2312"
Replace:
Response. addheader "Content-Type", "text/html; charset = gb2312"
In the netbox environment, Ajax uses get to get data and solves Chinese garbled characters!
Bytes -----------------------------------------------------------------------------------
Appendix:
Theoretically, if UTF-8 is used for development on the entire site, the Garbled text problem can also be solved. However, I usually write ASP programs in gb2312 encoding, and UTF-8 is not tested.