X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=doclib%2Ffix-links.py;h=fb7450eb4d564cb90ae0d62fe5935e365e513047;hb=2d54670ccdd4125df7dbb897afde882b6ec505ee;hp=27ee4d5ea0eeda55a7f6b1e336244433cd29c7a5;hpb=dbb053aa51bcb27e32f6e7426c6d13808035950e;p=senf.git diff --git a/doclib/fix-links.py b/doclib/fix-links.py index 27ee4d5..fb7450e 100644 --- a/doclib/fix-links.py +++ b/doclib/fix-links.py @@ -26,7 +26,7 @@ # index. Doxygen seems to create links with the wrong number of 'g' # charachters in front sometimes. -import sys,os.path,fnmatch, HTMLParser, getopt, re +import sys,os.path,fnmatch, HTMLParser, getopt, re, codecs class HTMLFilter(HTMLParser.HTMLParser): @@ -213,11 +213,11 @@ class LinkFixer: def fix(self, path, target): self._files += 1 - data = file(path).read() + data = codecs.open(path, "r", "utf-8").read() filt = LinkFixer.LinkFilter(self._index, target, "../" * (len(os.path.split(path)[0].split("/"))), - file(path,"w")) + codecs.open(path, "w", "utf-8") ) filt.feed(data) filt.close() found, fixed, removed = filt.stats() @@ -232,8 +232,7 @@ class LinkFixer: (opts, args) = getopt.getopt(sys.argv[1:], "vs:") if len(args) != 2: - sys.stderr.write("""Usage: - fix-links.py [-s skip-dir]... + sys.stderr.write("""Usage: fix-links.py [-s skip-dir]... Process the 'errorX.txt' and 'errorAX.txt' files as generated by 'linklint': Check all invalid links and try to find the correct