1. AJAXspacer
  2. ASPspacer
  3. CSSspacer
  4. Javascriptspacer
  5. Windows 應用程式spacer
  6. 網頁設計
  7. 評論、短文、雜文spacer
  8. 版主spacer
  9. 最新回應spacer


ASP UTF-8 編碼發生錯誤後,網站變亂碼

7/11 08' icon


當在 IIS 站台中建立以 UTF-8 編碼的網頁後,發生 500 錯誤時,IIS 預設的訊息是以作業系統為準,所以我的 IIS 就會以 BIG5 編碼回傳錯誤訊息。

這時,你看到的全部都是亂碼,好,Google 一下,你會發現大家都告訴你要自訂錯誤,把 C:\WINDOWS\Help\iisHelp\common 目錄下的 500-100.asp 複製到你的網站,例如根目錄下,再去 IIS 中把自訂訊息中的 500 改成以 URL 指到 /500-100.asp。同時,這個 500-100.asp 的檔案,不要忘了存成 UTF-8 格式。


當再度發生 500 錯誤,雖然這時你可以很清楚得知是那一行程式碼有問題,不過接下來,整個網站全部變成亂碼!解決方法有兩種:一個、重啟 IIS 或把 global.asa 改一下,第二個、關閉瀏覽器(要全部關喔)重開。



首先,改變 500-100.asp 這個動作是沒有問題的,也的確要這麼作,這裡有個測試頁,指令打錯字,產生的錯誤,是不是沒有亂碼了?(這份500-100.asp 是我自己改的,原作可沒有這麼可愛咧)。

其次,整個網站變亂碼的問題,一樣出在 500-100.asp 這個檔案中,找到 Session.Codepage 這裡,你會發現 M$ 的大哥把編碼指定為 1252,非常怪,如果是 BIG5,也該指定成 950 啊!1252 是 window-1252 的編碼,而且這個指令是 Session 喔!難怪一發生錯誤,呼叫了 500-100.asp 後,你所有頁面會變亂碼!


  1. 找到 Session.Codepage=1252,改成 Session.Codepage=65001。這行之上,有一行 bakCodepage = Session.Codepage ,用意是把原編碼保存,不過,通常如果沒有指定這個編碼時,預設就是作業系統語言。所以才要進行下一項修正。
  2. 在檔案一開始 Option Explicit 後插入兩行:
  3. Response.Charset="utf-8"
    其實,Session.Codeopage 的設定,你也可以加在 global.asa 的 Session_OnStart 裡。
  4. 第一行 <%@ language="VBScript" %> 刪不刪,看你的心情了!




on the main page   2017/8/30 上午 09:29:00

Hello! I'm at work browsing your blog from my new iphone!
Just wanted to say I love reading your blog and look forward
to all your posts! Carry on the superb work!

Danny   2017/8/30 上午 07:04:00

I’m not that much of a internet reader to be honest but your
blogs really nice, keep it up! I'll go ahead and
bookmark your site to come back later. All the best

Can you get taller with yoga?   2017/8/29 下午 01:35:00

We stumbled over here from a different web address and thought I
may as well check things out. I like what I see so i am just following you.
Look forward to looking into your web page for a second time.

Can better posture make you taller?   2017/8/29 上午 05:18:00

It's nearly impossible to find well-informed people on this
subject, but you seem like you know what you're talking about!


Can you have an operation to make you taller?   2017/8/28 上午 03:56:00

Good post. I am facing many of these issues as well..

What is a heel lift?   2017/8/27 下午 11:43:00

Sweet blog! I found it while browsing on Yahoo News.
Do you have any tips on how to get listed in Yahoo News? I've been trying for a while but
I never seem to get there! Cheers

What is the Ilizarov method?   2017/8/21 上午 11:51:00

This is my first time go to see at here and i am in fact happy to read everthing at one place.

mallietatsapaugh.weebly.com   2017/8/12 下午 08:31:00

You really make it appear really easy with your presentation but I in finding this matter to be really one thing which I think
I would never understand. It kind of feels too complex and extremely broad for me.

I am having a look forward for your next submit, I will attempt to get the hold of it!

How long do you grow during puberty?   2017/8/4 上午 09:21:00

WOW just what I was searching for. Came here
by searching for Photo Shop PhotoShop DHTML Dynamic HTML DynamicHTML
CSS Cascading Style Sheet JavaScript Demo Cool Website Audi Carousel 動態網頁 設計 專業 網站 討論區

Can you lose weight by doing yoga?   2017/7/31 上午 10:44:00

For most recent news you have to go to see world wide web and on the web I found this web page as a most excellent site for most up-to-date updates.

tracisoricelli.wordpress.com   2017/7/30 下午 11:55:00

Hey there! Quick question that's totally off topic.
Do you know how to make your site mobile friendly?
My web site looks weird when browsing from my iphone.
I'm trying to find a theme or plugin that might be able to fix this problem.
If you have any suggestions, please share. Cheers!

Why is my Achilles tendon burning?   2017/7/23 上午 11:31:00

Hello There. I found your blog using msn. This is a very well written article.

I will be sure to bookmark it and return to read more of your useful information. Thanks for the post.
I will certainly comeback.

What causes painful Achilles tendon?   2017/7/22 下午 04:51:00

Hi there, its pleasant article about media print, we all be
familiar with media is a impressive source of facts.

leg an foot pain   2017/7/4 上午 01:40:00

This is the perfect webpage for anybody who would
like to find out about this topic. You understand so much its almost hard to argue with you (not that
I actually will need to?HaHa). You definitely put a fresh spin on a topic that has been written about for years.
Excellent stuff, just great!

http://gertrudisgreenwalt.wordpress.com   2017/6/17 上午 12:48:00

Thankfulness to my father who shared with me on the topic
of this webpage, this weblog is really remarkable.

manicure   2017/4/11 下午 06:10:00

I couldn't refrain from commenting. Well written!

SEO - Internet Marketing   2009/12/28 下午 01:08:00


ironamn   2009/2/19 下午 11:19:00

<META HTTP-EQUIV="Content-Type" Content="text-html; charset=big5">


<META HTTP-EQUIV="Content-Type" Content="text-html; charset=utf-8">

小生   2009/2/11 下午 10:29:00


張吉米   2008/7/16 下午 12:01:00





卜維丰   2008/7/14 下午 03:54:00


至於 IE6/7/8 你可以試試使用標準模式(xHTML) 相容度會好很多~~^^

卜維丰   2008/7/14 下午 12:59:00

吉米, 你說的似乎有理~^^

可惜分享在你來看, 是叫作強迫, 對我而言, 卻像他鄉遇故知一般

用不用 Cookies, 就像父子騎馬, 有人贊成有人反對, 不過你提醒我一件事, 似乎是太專制, 這倒可以改一改

最後很抱歉 save.asp 不存在, 主要是有垃圾機器人不斷在掃描, 每隔一陣子, 存檔的程式就要換個檔名, 這點在此致歉

張吉米   2008/7/14 上午 10:58:00

我使用 FireFox,因為IE太爛了,光是自己三個版本的IE(6、7、8)就無法完全相容,感謝GOOGLE大神讓微軟知道自己的錯誤。

  如果您是要發問問題, 最好有個問題測試的網址, 這樣比較容易找到您問題所在, 謝謝