0

Update - 31 Aug

string test = "ö";
string unicode1 = HttpUtility.UrlEncode(test, Encoding.Unicode);
string unicode2 = HttpUtility.UrlEncodeUnicode(test);
Console.WriteLine("Result of unicode1: " + unicode1);
Console.WriteLine("Result of unicode2: " + unicode2);

we can see the different results. now the case is when i was using UrlEncode the parameter in URL for posting the data, it returns would become unicode2 when the browser is getting the resources.

Update - 30 Aug please click the link to see the tracing httprequest it was strange that the value of the parameter "nm" in QueryString became different, its original string was "ööö", so we can see it in Url, after encoding by UTF-8, it became "%c3%b6%c3%b6%c3%b6%" in RawUrl, in normal case, it should keep the same result of encoding between RawUrl and QueryString. Does anyone know the reason?

I encountered an issue that the URL referrer will become to null after clicking the button. I filled in the text "öööööööö", you can see the different encoding between c# and IE.

the url encoded by c#, it was captured by Fiddler

the url encoded by IE, it was displayed in IE status bar

Result of encoding by UTF8: “%c3%b6%c3%b6%c3%b6%c3%b6%c3%b6%c3%b6%c3%b6%c3%b6”

Result of encoding by IE: “%u00f6%u00f6%u00f6%u00f6%u00f6%u00f6%u00f6%u00f6”

does anyone know how it happen and give a hand?

yuc
  • 13
  • 5
  • 1
    Neither of these is a UTF8 encoding. The page you see uses UTF8 encoding. `余昌泼` is a UTF8 encoded string. The first string *is* a [URL encoding](https://www.w3schools.com/tags/ref_urlencode.asp). The second isn't. IE does *not* encode string by itself though - how was this string generated? What code created either of them? – Panagiotis Kanavos Aug 09 '18 at 10:34
  • apologizes for late reply! thanks for the comments! please see the new screenshot @PanagiotisKanavos – yuc Aug 30 '18 at 08:08
  • thanks you too! please see the new findings @GeorgeHelyar – yuc Aug 30 '18 at 08:15
  • i am sorry i flagged wrongly to your comment, can i remove the flag? i can not find the operation.@GeorgeHelyar – yuc Aug 30 '18 at 08:37

0 Answers0