From b102942047b0b68e8cfc2b999aee4dcac11adaf6 Mon Sep 17 00:00:00 2001 From: Masao Uebayashi Date: Fri, 15 Jan 2021 15:59:21 +0900 Subject: [PATCH] Decode UTF8 input before passing it to parseXMLDoc --- src/Graphics/Svg.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Graphics/Svg.hs b/src/Graphics/Svg.hs index d1a8b22..b6b0733 100644 --- a/src/Graphics/Svg.hs +++ b/src/Graphics/Svg.hs @@ -41,12 +41,12 @@ import Graphics.Svg.XmlParser -- a SVG Document. loadSvgFile :: FilePath -> IO (Maybe Document) loadSvgFile filename = - parseSvgFile filename <$> B.readFile filename + parseSvgFile filename . T.unpack . T.decodeUtf8 <$> B.readFile filename -- | Parse an in-memory SVG file parseSvgFile :: FilePath -- ^ Source path/URL of the document, used -- to resolve relative links. - -> B.ByteString + -> String -> Maybe Document parseSvgFile filename fileContent = parseXMLDoc fileContent >>= unparseDocument filename