还是编码,最近老和编码打交道: 关于ASP页面 post 数据到ASP.NET页面的问题
Yovav : do U think it's possible that codepage is "lost" when POSTing data from ASP to an ASP.NET page ?
Samuel: To your question
"do U think it's possible that codepage is "lost" when POSTing data from ASP to an ASP.NET page ? ", I think it's not possible --- It's really truth :).
When posting data from ASP to ASP.NET page, the codepage will automatically be changed into UTF-8.
Therefor, you'd better set your ASP.NET page's codepage/charset correctly.
Yovav : How can I traslate this to ASP.NET (or at least define the CodePage) ?
Session.CodePage=1252 ' IMPORTANT: syncronize with the server code page
Response.Charset= "utf-8" ' IMPORTANT: make the server respond with correct charset
%>
Thanks again.
My form is now POSTing correctly - thanks to you :-)
Samuel: From your code, I found that you want dynamic codepage/charset for response. Is it?
For dynamic response in ASP.NET, put the follow code in Page_Load() event of .cs/.vb file :Session.CodePage=1252
Response.Charset="utf-8";
For static response, modify .aspx file like this:Inherits="AspPostToAsp.Net.WebForm1" codePage="1252"%>
...
If you used Session and Response Object to set codepage/charset, the defined value in .aspx file will be invalid.
It seems that codepage of UTF-8 is 65001 against 1252 in ASP.NET.
Yovav : I thought I should do it like this,
so the only solution for me is to use your great two conversion functions
great job ! - I'm sure that a lot of people don't have a clue how to deal with this problem...
标签: ASP.NET, Programming
