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:
parent
971927c91f
commit
7daec5bb6b
@ -53,6 +53,7 @@ decodeUTF8 ~(w1:rest1)
|
|||||||
.|. ((fromIntegral $ w2 .&. 0x3F) `shiftL` 12)
|
.|. ((fromIntegral $ w2 .&. 0x3F) `shiftL` 12)
|
||||||
.|. ((fromIntegral $ w3 .&. 0x3F) `shiftL` 6)
|
.|. ((fromIntegral $ w3 .&. 0x3F) `shiftL` 6)
|
||||||
.|. (fromIntegral $ w4 .&. 0x3F),rest4)
|
.|. (fromIntegral $ w4 .&. 0x3F),rest4)
|
||||||
|
_ -> throwDyn UnexpectedEnd
|
||||||
| otherwise = throwDyn (IllegalCharacter w1)
|
| otherwise = throwDyn (IllegalCharacter w1)
|
||||||
|
|
||||||
data UTF8AnalyzeState
|
data UTF8AnalyzeState
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user