Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge

  • Loading branch information...
commit 80ceb7afc9d31d7db7b961d1331a6a0a38c6c97b 2 parents 61dab8f + 9d76a74
@bos authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 Data/Aeson/Parser/Internal.hs
View
17 Data/Aeson/Parser/Internal.hs
@@ -37,7 +37,7 @@ import Data.ByteString as B
import Data.Char (chr)
import Data.Monoid (mappend, mempty)
import Data.Text as T
-import Data.Text.Encoding (decodeUtf8)
+import Data.Text.Encoding (decodeUtf8')
import Data.Vector as Vector hiding ((++))
import Data.Word (Word8)
import qualified Data.Attoparsec as A
@@ -175,11 +175,16 @@ jstring_ = {-# SCC "jstring_" #-} do
then Nothing
else Just (c == backslash)
_ <- A.word8 doubleQuote
- if backslash `B.elem` s
- then case Z.parse unescape s of
- Right r -> return (decodeUtf8 r)
- Left err -> fail err
- else return (decodeUtf8 s)
+ s' <- if backslash `B.elem` s
+ then case Z.parse unescape s of
+ Right r -> return r
+ Left err -> fail err
+ else return s
+
+ case decodeUtf8' s' of
+ Right r -> return r
+ Left err -> fail $ show err
+
{-# INLINE jstring_ #-}
unescape :: Z.Parser ByteString
Please sign in to comment.
Something went wrong with that request. Please try again.