aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-01-14 17:38:34 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2013-01-14 17:38:34 -0800
commit51e0bd277a736fe7d11e456a17ff7995b71db60e (patch)
tree600bee8d5e4e075a6cc9bb9d827e1bd83a8b2221 /src/Text
parent0ef24d15188243aa7ad78c4ef65d6c6b8ed0a84e (diff)
downloadpandoc-51e0bd277a736fe7d11e456a17ff7995b71db60e.tar.gz
Parsing: Fixed uri -- escape unicode URLs.
Otherwise Network.URI.parseURI fails on e.g. Chinese URLs. Changed an incorrect test in markdown-reader-more.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Parsing.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 8f085d579..922799171 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -153,7 +153,7 @@ import Text.Parsec
import Text.Parsec.Pos (newPos)
import Data.Char ( toLower, toUpper, ord, isAscii, isAlphaNum, isDigit, isPunctuation )
import Data.List ( intercalate, transpose )
-import Network.URI ( parseURI, URI (..), isAllowedInURI )
+import Network.URI ( parseURI, URI (..), isAllowedInURI, isUnescapedInURI, escapeURIString )
import Text.Pandoc.Shared
import qualified Data.Map as M
import Text.TeXMath.Macros (applyMacros, Macro, parseMacroDefinitions)
@@ -380,7 +380,7 @@ uri = try $ do
str <- liftM concat $ many1 $ inParens <|> count 1 (innerPunct <|> uriChar)
str' <- option str $ char '/' >> return (str ++ "/")
-- now see if they amount to an absolute URI
- case parseURI (escapeURI str') of
+ case parseURI (escapeURIString isUnescapedInURI str') of
Just uri' -> if uriScheme uri' `elem` protocols
then return (str', show uri')
else fail "not a URI"