Changeset 25
- Timestamp:
- 11/27/07 03:40:56 (6 months ago)
- Files:
-
- trunk/lib/xmltools.py (modified) (4 diffs)
- trunk/misc/repository/make-addons-list.py (modified) (2 diffs)
- trunk/opendict.py (modified) (1 diff)
- trunk/scripts/make-addons-list.py (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/xmltools.py
r15 r25 21 21 22 22 import xml.dom.minidom 23 import xml.dom.ext24 23 25 24 from lib import meta … … 114 113 """Write XML file""" 115 114 116 fd = open(path, 'w') 117 xml.dom.ext.PrettyPrint(doc, fd) 115 import codecs 116 fd = codecs.open(path, 'w', 'utf-8') 117 doc.writexml(fd, addindent = " ", newl = "\n", encoding = "UTF-8") 118 118 fd.close() 119 119 120 120 121 121 … … 242 242 """Write XML file""" 243 243 244 fd = open(path, 'wb') 245 xml.dom.ext.PrettyPrint(doc, fd) 244 import codecs 245 fd = codecs.open(path, 'wb', 'utf-8') 246 doc.writexml(fd, addindent = " ", newl = "\n", encoding = "UTF-8") 246 247 fd.close() 247 248 … … 512 513 """Write XML file""" 513 514 514 fd = open(path, 'w') 515 xml.dom.ext.PrettyPrint(doc, fd) 515 import codecs 516 fd = codecs.open(path, 'w', 'utf-8') 517 doc.writexml(fd, addindent = " ", newl = "\n", encoding = "UTF-8") 516 518 fd.close() 517 519 trunk/misc/repository/make-addons-list.py
r15 r25 6 6 import md5 7 7 import xml.dom.minidom 8 import xml.dom.ext9 8 10 9 # … … 267 266 print "* %s" % filePath 268 267 268 import codecs 269 269 doc = makeDocument(xmlElements) 270 fd = open('opendict-add-ons.xml', 'w') 271 xml.dom.ext.PrettyPrint(doc, fd) 270 fd = codecs.open('opendict-add-ons.xml', 'w', 'utf-8') 271 doc.writexml(fd, addindent = " ", newl = "\n", encoding = "UTF-8") 272 #fd.write(doc.toprettyxml(indent = " ", newl = "\n")) 272 273 fd.close() 273 274 274 275 275 276 if __name__ == "__main__": trunk/opendict.py
r16 r25 51 51 print >> sys.stderr, "** Error: wxPython library not found" 52 52 print >> sys.stderr, "** Please install wxPython 2.5 or later to run OpenDict" 53 print >> sys.stderr, "**"54 sys.exit(1)55 56 57 try:58 import xml.dom.ext59 except ImportError:60 print >> sys.stderr, "**"61 print >> sys.stderr, "** Error: Python/XML library not found"62 print >> sys.stderr, "** Please install python-xml (PyXML) to run OpenDict"63 53 print >> sys.stderr, "**" 64 54 sys.exit(1)
