By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

UTF-8 and Server.URLEncode

P: n/a
We are running ASP classic on IIS 5 on W2k SP4. We recently added <%
Response.charset="utf-8"%to the top of all our pages (as suggested by
validator.w3.org). A problem arose on a page which applies
Server.HTMLEncode to a field that was inputted from the user. The
problem is that when the user enters a phrase such as:

My Fiancé

The Server.URLEncode returns the value:

My Fiancé

which doesn't appear correct. When I take out the <%
Response.charset="utf-8"%line, it returns

My Fiancé

which displays correctly. Am i ok to just leave out the <%
Response.charset="utf-8"%line, or should I use a different charset?
or is there some other fix?

Jan 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
>>>
"burnsy2000" <mc*******@gigmasters.comwrote in message
news:11*********************@s34g2000cwa.googlegro ups.com...
We are running ASP classic on IIS 5 on W2k SP4. We recently added <%
Response.charset="utf-8"%to the top of all our pages (as suggested by
validator.w3.org).
<<<

You also require Session.CodePage = 65001.
>>>
A problem arose on a page which applies
Server.HTMLEncode to a field that was inputted from the user. The
problem is that when the user enters a phrase such as:

My Fiancé

The Server.URLEncode returns the value:

My Fiancé

<<<

I think you are confusing URLEncode with HTMLEncode. The output is
consistent with HTMLEncode. What you are seeing here is the posted form
data being formatted as UTF-8 but being read by the server as 1252 (or
whatever your default OEM codepage is).

>>>
which doesn't appear correct. When I take out the <%
Response.charset="utf-8"%line, it returns

My Fiancé

which displays correctly. Am i ok to just leave out the <%
Response.charset="utf-8"%line, or should I use a different charset?
or is there some other fix?
<<<
If you ensure ALL pages Begin with Session.CodePage = 65001 and
Response.CharSet = "UTF-8" your problems should go away. (Note if you have
been saving results of form posts to a DB you may well have corrupt entiries
in your DB)

Anthony.
Jan 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.