diff --git a/scripts/rdf.py b/scripts/rdf.py index a8d0795..f31daf9 100755 --- a/scripts/rdf.py +++ b/scripts/rdf.py @@ -21,14 +21,15 @@ g = Graph() def percent_encode(string): """ - A few manpages contain special characters that are not valid symbols in a URL's - path. Since we use node URIs like , we need - to percent-encode these otherwise the URLs are invalid. - The reason for using a custom method instead of urllib.parse.quote() is that quote() - will percent-encode *any* non-ASCII character. + A few manpages contain special characters in their name that are not valid in a URL's + path. Since we use node URIs like we need to + %-encode these, otherwise the URLs are invalid. + The reason for using a custom method instead of urllib.parse.quote() is that urllib + only works with URLs but not IRIs, therefore quote() will %-encode *any* non-ASCII + character. """ - return string.replace(' ', '_') \ + return string.replace(' ', '%20') \ .replace('#', '%23') \ .replace('[', '%5B') \ .replace(']', '%5D')