Solved

How to define charset of UrlEncode ?

Posted on 2004-09-22
2
1,414 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
ID: 12125628
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
ID: 12125987
Ok, thanks a lot!!!! It works.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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