aesiniath / http-streams

Haskell HTTP client library for use with io-streams
https://hackage.haskell.org/package/http-streams
BSD 3-Clause "New" or "Revised" License
50 stars 48 forks source link

Fix URL encoding. #54

Closed romanb closed 10 years ago

romanb commented 10 years ago

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.

istathar commented 10 years ago

@gregorycollins

This was your code originally; patch seems fine to me, but would welcome your comment.

AfC

gregorycollins commented 10 years ago

looks ok