I would like to prepare a string for to put it into a "post" request. Unfortunately all the methods I found to encode an url seem to apply percent-encoding only to a handful of characters. The various methods, eg. HttpUtility.UrlEncode
, leave some characters, such as () and § untouched.
Percent-encoding of every utf-8 character with c#
5.1k Views Asked by user1046221 At
2
There are 2 best solutions below
2

Unfortunately, most existing converters only look at the non-compatible URL characters. Mainly for (as you mentioned) URL encoding, or for the prevention of cross site scripting.
If you want to make one from scratch, it would take some time to do the look-up, but it would be interesting. You could override existing encoders and add the additional characters that concern you, or change all letters and numbers too.
Here is a good link for UTF/ASCII --> HTML Encoded (%)
Is this more what you're looking for?
which outputs: