Shebin
Shebin

Reputation: 3468

Url encoding with French Character

i need to pass special characters trough the webservice. i used the code

HttpUtility.UrlEncode("french character")

but the encoding is not working correctly if the string contains a double Quots

eg: HttpUtility.UrlEncode("é")

it encodes fine. but not decodes properly

......Thank in advance ......

Upvotes: 7

Views: 6731

Answers (4)

Laxman
Laxman

Reputation: 11

String output = new String(input.getBytes(),"UTF-8");

Upvotes: 0

Shebin
Shebin

Reputation: 3468

Url encoding of the french character é is %E9

when we use

HttpUtility.UrlEncode("é")

we get the output as %c3%a.

HttpUtility.UrlEncode("é", System.Text.Encoding.GetEncoding("ISO-8859-1")

gives the correct encoded output ie %E9

Upvotes: 7

Oleg Grishko
Oleg Grishko

Reputation: 4281

It's encoded fine, try:

HttpUtility.UrlDecode(HttpUtility.UrlEncode("somecodes\""))

Upvotes: -2

qJake
qJake

Reputation: 17139

I don't see what your problem is. This code:

Console.WriteLine(System.Web.HttpUtility.UrlEncode("something enclosed \"in quotes\""));

outputs this result:

something+enclosed+%22in+quotes%22

just as it should, without the \ character. So what's the problem, exactly?

Upvotes: 2

Related Questions