summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-27 11:36:08 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-27 11:37:35 -0800
commit8a35b44aaf82f0b6cf8384aa78d92f963ad7ee92 (patch)
treeff9edc2d9f65e9e09cd15dbc9fce1c65f1797784 /src
parent3b2282c96234f6f8c82d86f124d43c949b44688d (diff)
Allow lenient decoding of *latex error logs.
These sometimes aren't properly UTF8 encoded, and it's confusing if we get an encoding error due to the error log. Closes #4200.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/App.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index e597c56d6..641d3782b 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -58,6 +58,9 @@ import Data.Monoid
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text as T
+import qualified Data.Text.Lazy as TL
+import qualified Data.Text.Lazy.Encoding as TE
+import qualified Data.Text.Encoding.Error as TE
import Data.Yaml (decode)
import qualified Data.Yaml as Yaml
import GHC.Generics
@@ -513,7 +516,9 @@ convertWithOpts opts = do
case res of
Right pdf -> writeFnBinary outputFile pdf
Left err' -> liftIO $
- E.throwIO $ PandocPDFError (UTF8.toStringLazy err')
+ E.throwIO $ PandocPDFError $
+ TL.unpack (TE.decodeUtf8With TE.lenientDecode err')
+
Nothing -> do
let htmlFormat = format `elem`
["html","html4","html5","s5","slidy",