Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > UTF-8 and Server.URLEncode

Reply
Thread Tools

UTF-8 and Server.URLEncode

 
 
burnsy2000
Guest
Posts: n/a
 
      01-02-2007
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?

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      01-03-2007

>>>

"burnsy2000" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments