Closed brianberns closed 2 years ago
Sorry, it looks like I simply forgot to call setMimeType "text/plain; charset=utf-8"
on my response. I'm double-checking now, but I think Suave is probably functioning correctly here, in which case the bug can be closed.
Suave seems to assume that URL-encoded data should always be decoded as ASCII, which means that non-ASCII form data is decoded incorrectly. Consider the follow program, which simply echoes the posted form's
text
value:We can invoke this from PowerShell as follows:
The input is
test ááá
, but the output istest ááá
. Explicitly setting the content type via-ContentType "text/plain; charset=utf-8"
has no effect on the result.I did a little debugging, and I think the problem is in
parseData
:Unfortunately, the .NET method
WebUtility.UrlDecode
always "replaces hexadecimal escape sequences with corresponding ASCII character equivalents". I think thatHttpUtility.UrlDecode
might be a better choice instead, since it allows an encoding to be specified.