git.iko.soy/typeable/pandoc
on master help sign in
Add unicode code point in "Missing character" warning.

If the character isn't in the console font, the message is pretty useless, so we show the code point for anything non-ASCII. Closes #5538.

commit39a3a025dae95b6bafb9b86f2c2eefd4cd0cb3b7 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 30 May 2019, 17:31 (7 years ago) parent9f43b2e
1 file changed+8−1
src/Text/Pandoc/PDF.hs+8−1
src/Text/Pandoc/PDF.hs+8−1
@@ -27,6 +27,8 @@ import qualified Data.ByteString.Lazy.Char8 as BC
2727import Data.Maybe (fromMaybe)
2828import Data.Text (Text)
2929import qualified Data.Text as T
30+import Text.Printf (printf)
31+import Data.Char (ord, isAscii)
3032import System.Directory
3133import System.Environment
3234import System.Exit (ExitCode (..))
@@ -243,7 +245,12 @@ missingCharacterWarnings :: Verbosity -> ByteString -> PandocIO ()
243245missingCharacterWarnings verbosity log' = do
244246 let ls = BC.lines log'
245247 let isMissingCharacterWarning = BC.isPrefixOf "Missing character: "
246− let warnings = [ UTF8.toStringLazy (BC.drop 19 l)
248+ let addCodePoint [] = []
249+ addCodePoint (c:cs)
250+ | isAscii c = c : addCodePoint cs
251+ | otherwise = c : " (U+" ++ printf "%04X" (ord c) ++ ")" ++
252+ addCodePoint cs
253+ let warnings = [ addCodePoint (UTF8.toStringLazy (BC.drop 19 l))
247254 | l <- ls
248255 , isMissingCharacterWarning l
249256 ]