This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients MLModel, loewis, ronaldoussoren
Date 2010-12-21.17:00:35
SpamBayes Score 2.7766322e-07
Marked as misclassified No
Message-id <1292950837.2.0.847454333341.issue10733@psf.upfronthosting.co.za>
In-reply-to
Content
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>).
History
Date User Action Args
2010-12-21 17:00:37ronaldoussorensetrecipients: + ronaldoussoren, loewis, MLModel
2010-12-21 17:00:37ronaldoussorensetmessageid: <1292950837.2.0.847454333341.issue10733@psf.upfronthosting.co.za>
2010-12-21 17:00:35ronaldoussorenlinkissue10733 messages
2010-12-21 17:00:35ronaldoussorencreate