diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/XML.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs index cf12bf482..8d7a2720c 100644 --- a/src/Text/Pandoc/XML.hs +++ b/src/Text/Pandoc/XML.hs @@ -26,6 +26,7 @@ import Data.Text (Text) import qualified Data.Text as T import Text.HTML.TagSoup.Entity (lookupEntity, htmlEntities) import Text.DocLayout +import Text.Printf (printf) import qualified Data.Map as M import Data.String @@ -89,7 +90,7 @@ inTagsIndented tagType = inTags True tagType [] toEntities :: Text -> Text toEntities = T.concatMap go where go c | isAscii c = T.singleton c - | otherwise = T.pack ("&#" ++ show (ord c) ++ ";") + | otherwise = T.pack (printf "&#x%X;" (ord c)) -- | Escape all non-ascii characters using HTML5 entities, falling -- back to numerical entities. |