开发者

Url encoding with French Character

开发者 https://www.devze.com 2023-03-01 21:21 出处:网络
i need to pass special 开发者_JAVA技巧characters trough the webservice. i used the code HttpUtility.UrlEncode(\"french character\")

i need to pass special 开发者_JAVA技巧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 ......


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


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?


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


It's encoded fine, try:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消