From: tho Date: Tue, 25 Aug 2009 16:19:33 +0000 (+0000) Subject: doclib/fix-links: open files in utf-8 mode X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=ba6bd99f18046a11264e21ac6a70dbcb3c18e000;p=senf.git doclib/fix-links: open files in utf-8 mode git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1337 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/doclib/fix-links.py b/doclib/fix-links.py index 2fe5db6..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()