From 7daec5bb6b7303e8bc55e6474781dfe473cc2e29 Mon Sep 17 00:00:00 2001 From: Henning Guenther Date: Sun, 30 Dec 2007 15:46:32 -0800 Subject: [PATCH] Fixed UTF8 decoding bug There was an exception if trying to decode a sequence that had to have 4 bytes but had less. darcs-hash:20071230234632-a4fee-d10fca90840b37952a5d4a4c31a1c8e4900f0f93 --- Data/Encoding/UTF8.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Data/Encoding/UTF8.hs b/Data/Encoding/UTF8.hs index b9312c8..6679a7e 100644 --- a/Data/Encoding/UTF8.hs +++ b/Data/Encoding/UTF8.hs @@ -53,6 +53,7 @@ decodeUTF8 ~(w1:rest1) .|. ((fromIntegral $ w2 .&. 0x3F) `shiftL` 12) .|. ((fromIntegral $ w3 .&. 0x3F) `shiftL` 6) .|. (fromIntegral $ w4 .&. 0x3F),rest4) + _ -> throwDyn UnexpectedEnd | otherwise = throwDyn (IllegalCharacter w1) data UTF8AnalyzeState