URL Encoding German Chars problem. help please

  • Thread starter Thread starter feng zhu
  • Start date Start date
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
 
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")));
}
}
 
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,
 
Back
Top