Fiexed bug: cannot escape request including multi-byte sequence correctly
This commit is contained in:
parent
b06c4f5428
commit
d9be899bf5
@ -207,7 +207,7 @@ renderAuthHeader = ("OAuth " `BS.append`). BS.intercalate "," . map (\(a,b) -> B
|
||||
paramEncode :: BS.ByteString -> BS.ByteString
|
||||
paramEncode = BS.concatMap escape
|
||||
where
|
||||
escape c | isAlpha c || isDigit c || c `elem` "-._~" = BS.singleton c
|
||||
escape c | isAscii c && (isAlpha c || isDigit c || c `elem` "-._~") = BS.singleton c
|
||||
| otherwise = let num = map toUpper $ showHex (ord c) ""
|
||||
oct = '%' : replicate (2 - length num) '0' ++ num
|
||||
in BS.pack oct
|
||||
|
||||
Loading…
Reference in New Issue
Block a user