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

Source: Internet
Author: User
Tags error code iis

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

Reason:

Your site is utf-8 encoded, but the error message output for IIS defaults to using GB2312 encoding. The page displayed is garbled when a run-time error occurs in IIS.

Solution:

[Option 1]

Handle the error yourself and do not allow IIS to handle it.

In all possible areas of error, it is 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

[Option 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 Modify this file to Utf-8 encoding.

2.1) head plus @codepage =65001

2.2 Option Explicit followed by 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

Back of the carriage return to remove (this place Microsoft wrote wrong)

2.5 Configure IIS, set the custom error page, set the 500;100 type as the URL, and the URL set to/500-100.asp

2.6) Save 500-100.asp as Utf-8 encoding

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.