diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-31 14:51:23 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-31 14:51:23 -0800 |
commit | 52310eb4708f0737ad87ac5f1217571b3dc73a78 (patch) | |
tree | 02a675690f9f9c7f61f335b7591fd7ddbe08bcdd /src | |
parent | 3de830e4e285e8a9ad8954d9ca458da05048a7f7 (diff) | |
download | pandoc-52310eb4708f0737ad87ac5f1217571b3dc73a78.tar.gz |
SelfContained: Add `;charset=utf-8` to script mime type if missing.
Closes #1842.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/SelfContained.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 5b8f7a75a..a7f7f251e 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -67,7 +67,10 @@ convertTag media sourceURL t@(TagOpen "script" as) = [] -> return t src -> do (raw, mime) <- getRaw media sourceURL (fromAttrib "type" t) src - let enc = "data:" ++ mime ++ "," ++ escapeURIString isOk (toString raw) + let mime' = if ';' `elem` mime + then mime -- mime type already has charset + else mime ++ ";charset=utf-8" + let enc = "data:" ++ mime' ++ "," ++ escapeURIString isOk (toString raw) return $ TagOpen "script" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"]) convertTag media sourceURL t@(TagOpen "link" as) = case fromAttrib "href" t of |