From 524a6f8bdf35c37998072fc1692c681c45a336f7 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 10 Jan 2006 14:39:38 +0000 Subject: [PATCH] [project @ 2006-01-10 14:39:38 by simonmar] prevChar: don't back up over decoding errors --- ghc/compiler/utils/Encoding.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 1.7.10.4