Ronald Oussoren <[email protected]> added the comment:
I agree with Martin that this is a tricky one.
The file is problematic because it is invalid XML[1], however Apple's tools are
perfectly happy to proces the file and as Mitchell notes plistlib exists to
interoperate with Apple's plist files.
I'm therefore reopening the issue, but with a low priority. It is unlikely that
I'll work on this in the near future though.
Replacing all control characters by entities before trying to parse the Plist
XML would likely be the best way forward. A patch (including testcases) would
definitely be appreciated.
BTW. I've checked that Apple's Cocoa libraries will read the file, this is not
just a bug in the xml1 output formatter of plutil.
Using PyObjC:
>>> from Foundation import NSDictionary
>>> d = NSDictionary.dictionaryWithContentsOfFile_('com.apple.Terminal.plist')
[1] It is invalid XML because it contains control characters which are invalid
according to the XML specification
(<http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char>).
----------
priority: normal -> low
stage: committed/rejected -> unit test needed
status: closed -> open
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10733>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com