Nov
29
2008

Binary Property Lists

While discovering how to get MobileMail to use multiple ‘From’ addresses, I found that the Accounts.plist file can spontaneously change format.

Well not quite spontaneously. I copied the file from my iPhone: it was plain text. I went into Settings, on the phone, and added a new Mail account, copied the file again: it was no longer text. According to the ‘file’ command it had become an ‘Apple binary property list’.

There is much on the web about editing plist files on MacOS X. Apple includes a Property List Editor tool with XCode. Unfortunately, I’m a Linux user and can’t use XCode. Luckily, some kind fellow has written a perl equivalent of this tool called plutil.pl.

Use it on binary propety lists like this:

$ perl ./plutil.pl Accounts.plist
plutil.pl v1.5

Old: Accounts.plist, from: binary, to: text
Found .plist
TryName: Accounts.text.plist
TryName: Accounts.text.plist
BinaryToXML:
Offsets are 2 bytes
Object Refs are 1 bytes
There are 64 objects in the file
The top object is at 0
The Offset Table is at offset 1210

Int Lengths = 61
Misc Lengths = 10
String Lengths = 1025
Unique Strings = 53

You now have a Accounts.text.plist file in the current directory which is nice plain XML.

Replacing a binary plist with its plain text equivalent should just work. I have done this on my iPhone and it appears to be ok. If you aren’t so sure, you can convert your plain text plist back to binary using the same tool:

$ perl ./plutil.pl Accounts.text.plist
plutil.pl v1.5

Old: Accounts.text.plist, from: text, to: binary
Found .text.plist
TryName: Accounts.binary.plist
TryName: Accounts.binary.plist
XMLToBinary:
NumObjects = 64
ObjRefSize = 1
String Lengths = 1025
Int Lengths = 61
Misc Lengths = 10
106 obj refs = 106
Object FileSize = 1242
OffsetSize = 2
Total Filesize = 1370
OffsetTableOffset = 1210

Unique strings = 53
Written by theboywho | Tags: ,

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

WordPress | Aeros