Solved

How to define charset of UrlEncode ?

Posted on 2004-09-22
2
1,406 Views
Last Modified: 2010-05-18
I have a problem when I use the method Server.UrlEncode in ASP.NET (c#)
I would like to use this method to encode characters in iso-8859-1.
For some reason, I have to send a request to a web server in ISO-8859-1 and not in UTF-8. And I have the impression this method encodes all non-ASCII characters in 2-bytes codes. How to force it to encode in iso-8859-1.
For exemple, Server.UrlEncode("é")  returns  %c3%a9
But  I would like to get :   %E9
I need the feature to be dynamic. Sometimes, it can also be windows-1251 or any others.
0
Comment
Question by:fpasquier
2 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 250 total points
Comment Utility
Hi,

use
HttpUtility.UrlEncode (this.Request.Url.PathAndQuery, System.Text.Encoding.GetEncoding("iso-8859-1"));

i'm not sure just if this is the code of the page you should enter - iso-8859-1

HTH
Regards,
B..M
0
 

Author Comment

by:fpasquier
Comment Utility
Ok, thanks a lot!!!! It works.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now