From ddfa7b2a630bd123c7b6291769c6ae1fe347aff4 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Wed, 8 Sep 2021 09:30:16 -0700
Subject: [PATCH] App: Issue NotUTF8Encoded warning when falling back to
 latin1.

---
 src/Text/Pandoc/App.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index f7c1f218d..b639a97b7 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -426,8 +426,12 @@ inputToText convTabs (fp, (bs,mt)) =
     Nothing           -> catchError
                            (utf8ToText fp bs)
                            (\case
-                              PandocUTF8DecodingError{} ->
-                                        return $ T.pack $ B8.unpack bs
+                              PandocUTF8DecodingError{} -> do
+                                report $ NotUTF8Encoded
+                                  (if null fp
+                                      then "input"
+                                      else fp)
+                                return $ T.pack $ B8.unpack bs
                               e -> throwError e)
 
 inputToLazyByteString :: (FilePath, (BS.ByteString, Maybe MimeType))