wooster/biplist — pull request #4 by geekman (2012-06-12 14:57:20+00:00)
Title: Bug when writing non-binary (XML) plist with Data values

If biplist is used to convert a binary plist into an XML one, like so:

plist = readPlist(..binary plist..)
writePlist(plist, file, binary=False)

and the binary plist happens to contain a `Data` value, this value would not be correctly represented in its XML form. In some cases, plistlib would raise a ValueError that says "_strings can't contains control characters; use plistlib.Data instead_".

This is because the `Data` class used by biplist is directly being passed to `plistlib`, but `plistlib` has its own `plistlib.Data` class to represent Data values.

This commit introduces a function `wrapDataObject` to convert to and from these different types during reading and writing of a non-binary plist. Test cases have also been added.