projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a85ab68
)
[project @ 2006-01-10 14:39:38 by simonmar]
author
simonmar
<unknown>
Tue, 10 Jan 2006 14:39:38 +0000
(14:39 +0000)
committer
simonmar
<unknown>
Tue, 10 Jan 2006 14:39:38 +0000
(14:39 +0000)
prevChar: don't back up over decoding errors
ghc/compiler/utils/Encoding.hs
patch
|
blob
|
history
diff --git
a/ghc/compiler/utils/Encoding.hs
b/ghc/compiler/utils/Encoding.hs
index
7b35e65
..
152bf3c
100644
(file)
--- 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