It seems that due to the use of Data.Char.isAlphaNum, which returns True for characters outside of the ASCII range, many bytes are not correctly encoded.
For example, ø in utf8 encodes to \195\184 and since isAlphaNum '\195' == True, the (incorrect) result was \195%b8.
This patch fixes the issue and also adds _ and ~ to the list of characters not needing any encoding as they appear in the list of unreserved characters according to RFC2396 and should thus never be encoded.
It seems that due to the use of
Data.Char.isAlphaNum
, which returnsTrue
for characters outside of the ASCII range, many bytes are not correctly encoded.For example,
ø
in utf8 encodes to\195\184
and sinceisAlphaNum '\195' == True
, the (incorrect) result was\195%b8
.This patch fixes the issue and also adds
_
and~
to the list of characters not needing any encoding as they appear in the list of unreserved characters according to RFC2396 and should thus never be encoded.