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
This commit is contained in:
Henning Guenther 2007-12-30 15:46:32 -08:00
parent 971927c91f
commit 7daec5bb6b

View File

@ -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