GNOME Bugzilla – Bug 696633
gdbus-codegen trips over unicode chars when using python 3.x
Last modified: 2013-08-17 04:44:25 UTC
An example of this is gnome-terminal which contains the copyright symbol in one of the XML files. This has never been any issue when gdbus-codegen was called from python 2.x, but with 3.x it throws an exception: GEN terminal-gdbus-generated.c Traceback (most recent call last):
+ Trace 231685
sys.exit(codegen_main.codegen_main())
xml_data = f.read()
return codecs.ascii_decode(input, self.errors)[0]
Created attachment 251905 [details] [review] codegen: Treat input file as binary Under C locale, open() in Python 3 sets the file encoding to ASCII. As expat looks at encoding="..." in XML declaration, gdbus-codegen can simply open the input file as binary and let expat decode the content. -- Tested with both Python 2 and 3, seems to work.
Review of attachment 251905 [details] [review]: thanks
Attachment 251905 [details] pushed as a7f2765 - codegen: Treat input file as binary