I'm trying to URL-encode some strings, however I have problems with methods provided by the .Net framework.
For instance, I'm trying the encode strings that contain the 'â' character. According to w3schools for instance, I would expect this caracter to be encoded as '%E2' (and a PHP system I must call expects this too...).
I tried using these methods:
System.Web.HttpUtility.UrlEncode("â");
System.Web.HttpUtility.UrlPathEncode("â");
Uri.EscapeUriString("â");
Uri.EscapeDataString("â");
However, they all encode this character as: %C3%A2
I suppose this has something to do with the fact that strings in .Net are UTF-16 encoded. So to avoid this problem, I can write this for instance:
"%" + ((int)character).ToString("X")
However, I would like to know if the framework already has a built-in method (I can't find any answer here or elsewhere as to why my character is encoded this way)?