URL Encoding German Chars problem. help please

F

feng zhu

Hi All,
I''m using c# in asp.net and I tried to encode some upper part of ASCII chars, eg. á
The desired result should be: %E1
But when I use HttpUtility.UrlEncode("á"), the output result is: %c3%a1
I tried ISO 8859-1 and utf-8, neither works.
anybody can help me?
Or other way to do it, javascript escape?no experice with that
thanks for any help

Feng
 
M

Martin Honnen

feng said:
I''m using c# in asp.net and I tried to encode some upper part of ASCII chars, eg. á
The desired result should be: %E1
But when I use HttpUtility.UrlEncode("á"), the output result is: %c3%a1
I tried ISO 8859-1 and utf-8, neither works.
anybody can help me?

I didn't know that á is a German character but I think what you want is
to encode from ISO-8859-1

using System;
using System.Web;

public class Test20031029 {
public static void Main (string[] args) {
string s = "á";
Console.WriteLine("{0} URLencoded: {1}", s,
HttpUtility.UrlEncode(s, System.Text.Encoding.GetEncoding("ISO-8859-1")));
}
}
 
J

Joerg Jooss

feng said:
Hi All,
I''m using c# in asp.net and I tried to encode some upper part of
ASCII chars, eg. á The desired result should be: %E1
But when I use HttpUtility.UrlEncode("á"), the output result is:
%c3%a1 I tried ISO 8859-1 and utf-8, neither works.
anybody can help me?

á isn't exactly a German character, and %c3%a1 is the correct URL
encoding for that character's UTF-8 representation.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top