[Go] solve the problem of UTF-8 file error garbled under IIS

Source: Internet
Author: User

Two days to find a solution .... Halo Halo ... Solved with the second method.

None of the methods found on the Internet have written this one.

If objasperror.aspdescription > "Then
The rear carriage return is removed (this place Microsoft wrote wrong)

Comment out the <br> in the back of this sentence!

Response.Write Server.HTMLEncode (objasperror.aspdescription) ' & <br> '

Transferred from: http://blog.csdn.net/Kevin__lin/article/details/4149784

Solve the problem of error garbled in UTF-8 file under IIS

Reason:
Your site is utf-8 encoded, but the error message output of IIS is using GB2312 encoding by default. The page that is displayed when IIS causes a run-time error is garbled.
Workaround:
[Method 1]
Handle the error yourself and not allow IIS to handle it.
In all possible places where mistakes are made, they are captured in a manner similar to the following.
On Error Resume Next
Err.Raise 6 ' This line is a possible error code
If ERR Then
Response.Write Err.Description
Response.End
End If
On Error Goto 0
[Method 2]
Change the IIS error message output default encoding.
1) Copy the c:/winnt/help/iishelp/common/500-100.asp to the website (root) directory
2) Change this file to Utf-8 encoding.
2.1) head plus @codepage =65001
2.2) Option Explicit after adding a line response.charset= "Utf-8"
2.3) Change Session.CodePage = 936 to Session.CodePage = 65001
2.4) The 156th Line
If objasperror.aspdescription > "Then
The rear carriage return is removed (this place Microsoft wrote wrong)
2.5) Configure IIS, set the custom error page, set the type of 500;100 as a URL, and the URL to/500-100.asp
2.6) Save 500-100.asp as Utf-8 encoding

[Go] solve the problem of UTF-8 file error garbled under IIS

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.