From d9be899bf5113b164af5cc27c7dc8b44b54d6f8d Mon Sep 17 00:00:00 2001 From: Hiromi Ishii Date: Tue, 21 Jun 2011 03:10:16 +0900 Subject: [PATCH] Fiexed bug: cannot escape request including multi-byte sequence correctly --- Web/Authenticate/OAuth.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Authenticate/OAuth.hs b/Web/Authenticate/OAuth.hs index 28e0bd8a..035d799e 100644 --- a/Web/Authenticate/OAuth.hs +++ b/Web/Authenticate/OAuth.hs @@ -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