I'm dealing with an issue in my application where text entered by a user is sent to the server as part of a URL to render an image. The text is encoded using the encodeURIComponent function, but I'm running into problems with certain characters like + or foreign characters.
For instance, if the input is "François + Anna", the resulting encoded URL looks like previewImage.ashx?id=1&text=Fran%25E7ois%2520%2B%2520Anna
When trying to decode this on the server using Uri.UnescapeDataString, I get an "Invalid URI: There is an invalid sequence in the string." error. If I remove the extended character, it decodes as "Francois + Anna".
Alternatively, using HttpUtility.UrlDecode with UTF8Encoding.UTF7, the foreign characters are decoded correctly but the encoded + becomes a space, resulting in "François Anna".