Commit 524a6f8b authored by simonmar's avatar simonmar
Browse files

[project @ 2006-01-10 14:39:38 by simonmar]

prevChar: don't back up over decoding errors
parent a85ab68b
......@@ -105,7 +105,7 @@ utf8PrevChar p = utf8CharStart (p `plusPtr` (-1))
utf8CharStart :: Ptr Word8 -> IO (Ptr Word8)
utf8CharStart p = go p
where go p = do w <- peek p
if (w .&. 0xC0) == 0x80
if w >= 0x80 && w < 0xC0
then go (p `plusPtr` (-1))
else return p
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment