国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

對于ASP編碼問題的深入研究與最終解決方案

2024-05-04 11:01:37
字體:
來源:轉載
供稿:網友

ASP亂碼確實棘手,這個說明比較權威。有待研究。哪的資料都不如官方資料權威。今天總算從MSDN中擇出了ASP編碼問題的解決方案。
... ASP亂碼確實棘手,這個說明比較權威。有待研究。

哪的資料都不如官方資料權威。今天總算從MSDN中擇出了ASP編碼問題的解決方案。

下面是MSDN中的一段話。

Setting @CODEPAGE explicitly affects literal strings in a single response. Response.CodePage affects dynamic strings in a single response, and Session.CodePage affects dynamic strings in all responses in a session.

這句話解釋清楚了@CODEPAGE,Response.CodePage,Session.CodePage 分別的作用是什么。

@CODEPAGE作用于所有靜態的字符串,比如某文件中的 const blogname="我的家"

Response.CodePage,Session.CodePage作用于所有動態輸出的字符串,比如<%=blogname%>

這句話很關鍵的是說明了Response.CodePage的作用范圍是a single response,而SXNA中聲明的Session.CodePage的作用范圍是all responses in a session。

再看另外一句話。

If Response.CodePage is not explicitly set in a page, it is implicitly set by Session.CodePage, if sessions are enabled. If sessions are not enabled, Response.CodePage is set by @CodePage, if @CodePage is present in the page. If there is no @CodePage in the page, Response.CodePage is set by the AspCodePage metabase property. If the AspCodePage metabase property is not set, or set to 0, Response.CodePage is set by the system ANSI code page.

這句話我乍一看,把意思理解成了這樣:在sessions are enabled的時候,如果Response.CodePage沒有聲明,則Response.CodePage會被Session.CodePage賦值。如果sessions are not enabled的時候, 如果@CodePage已聲明,則Response.CodePage會被@CodePage賦值,等等.............

這句話解釋了為什么從SXNA中出來以后進入一些別的頁面比如oblog,z-blog等等容易出現亂碼,因為其他程序沒有聲明Response.CodePage而恰巧SXNA聲明了Session.CodePage,因此一進入SXNA,Session.CodePage立即被賦值(版本不同,有的版本賦了936有的版本賦了65001),而后進入其他程序的時候Response.CodePage馬上被Session.CodePage賦值,如果這時Response.CodePage與頁面本身編碼不一樣的話,頁面就會出現亂碼。所以進入z-blog出現亂碼的時候我查了當時的Session.CodePage和Response.CodePage都是936,而進入oblog出現亂碼的時候Session.CodePage和Response.CodePage都是65001.就是說要想保證葉面不出現亂碼,應該聲明Response.CodePage,否則他就會按照Session.CodePage來解釋網頁(而不是按照@codepage解釋網頁).

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 边坝县| 虹口区| 象山县| 霞浦县| 丹阳市| 邹城市| 宜昌市| 云阳县| 阳新县| 慈溪市| 荣昌县| 邯郸市| 珠海市| 华安县| 万源市| 托里县| 永胜县| 鹰潭市| 伊川县| 宁安市| 外汇| 新乐市| 孟连| 日照市| 巴楚县| 大同县| 普陀区| 平昌县| 石楼县| 永春县| 建水县| 新乡市| 淮南市| 潜江市| 永德县| 五大连池市| 石城县| 盐边县| 武乡县| 宜丰县| 湖州市|