From: David F. <dav...@us...> - 2005-02-18 20:04:38
|
Update of /cvsroot/translate/src/translate/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12454 Modified Files: po.py Log Message: POT files contain CHARSET as a placeholder for the encoding, we need to ignore it (this could be improved to map CHARSET to None) Index: po.py =================================================================== RCS file: /cvsroot/translate/src/translate/storage/po.py,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- po.py 17 Feb 2005 17:54:06 -0000 1.46 +++ po.py 18 Feb 2005 20:04:28 -0000 1.47 @@ -490,7 +490,7 @@ charsetmatch = sre.search("charset=([^ ]*)", contenttype) self.encoding = charsetmatch and charsetmatch.group(1) # now that we know the encoding, decode the whole file - if self.encoding is not None: + if self.encoding is not None and self.encoding.lower() != 'charset': lines = self.decode(lines) else: finished = 1 @@ -567,7 +567,7 @@ """encode any unicode strings in lines in self.encoding""" newlines = [] encoding = self.encoding - if encoding is None: + if encoding is None or encoding.lower() == "charset": encoding = 'UTF-8' for line in lines: if isinstance(line, unicode): @@ -579,7 +579,7 @@ """decode any non-unicode strings in lines with self.encoding""" newlines = [] for line in lines: - if isinstance(line, str) and self.encoding is not None: + if isinstance(line, str) and self.encoding is not None and self.encoding.lower() != "charset": line = line.decode(self.encoding) newlines.append(line) return newlines |