Closed kunalrm closed 10 years ago
Stupid github stripped all the tags in the plist but I think you get an idea of what the problem is. If you still need a sample binary encoded plist I can upload one.
I'm very sorry, I've been really busy the last few days. I will have a look at this this evening, I've got about 5 hours traveling time to fill.
Can you retry this with the latest version of this gem? I can't reproduce this:
pl = CFPropertyList::List.new(file: './test.plist') # test.plist is your example code
puts CFPropertyList.native_types(pl.value)['favoriteitems']['CustomListItems'][0]['Alias'].class.inspect
=> CFPropertyList::Blob
Best regards, Christian Kruse
Closing because it works for me and OP doesn't respond
When you execute CFPropertyList.native_types(plist.value) on a plist which has a in it and is binary encoded, the gem returns the contents as string instead of type CFPropertyList::Blob. The issue seems to be in the initialize methods for CFData. Attached is the patch which I think should fix the problem.
Patch: def initialize(value=nil,format=DATA_BASE64) if(format == DATA_RAW) @raw_value = Blob.new(value) else @value = value end end
Sample Plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">