From: simonmar Date: Tue, 10 Jan 2006 14:39:38 +0000 (+0000) Subject: [project @ 2006-01-10 14:39:38 by simonmar] X-Git-Tag: final_switch_to_darcs,_this_repo_is_now_live~40 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=524a6f8bdf35c37998072fc1692c681c45a336f7;p=ghc-hetmet.git [project @ 2006-01-10 14:39:38 by simonmar] prevChar: don't back up over decoding errors --- diff --git a/ghc/compiler/utils/Encoding.hs b/ghc/compiler/utils/Encoding.hs index 7b35e65..152bf3c 100644 --- a/ghc/compiler/utils/Encoding.hs +++ b/ghc/compiler/utils/Encoding.hs @@ -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