From 3c31925bc79ec0f419981b6d9eee53f1f3d41f6b Mon Sep 17 00:00:00 2001 From: greenrd Date: Sun, 12 Sep 2010 15:31:37 +0100 Subject: [PATCH] Fix bug with page titles containing spaces by URL encoding page names --- wp2git.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp2git.d b/wp2git.d index 67dc333..57965c3 100644 --- a/wp2git.d +++ b/wp2git.d @@ -4,6 +4,7 @@ import std.stream; import std.string; import std.file; import std.conv; +import std.uri; import litexml; int main(string[] args) @@ -18,7 +19,7 @@ int main(string[] args) if (name.length>=2 && name[0]=='"' && name[$-1]=='"') name = name[1..$-1]; // strip quotes - if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ name, "-o", "history.xml"])) + if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ encodeComponent(name), "-o", "history.xml"])) throw new Exception("curl error"); fwritefln(stderr, "Loading history...");