cjwl / cocotron

The Cocotron
http://cocotron.org
MIT License
412 stars 103 forks source link

NSArchiver output incompatible with vanilla NSUnarchiver #11

Open gregzo opened 8 years ago

gregzo commented 8 years ago

Objects serialized with NSArchiver can't be deserialized with vanilla NSUnarchiver. Looking at the raw data, it seems that the 2 serialisation formats simply are different. Am I missing something?

Awesome project, by the way - invaluable learning tool.

cjwl commented 8 years ago

Last I checked, the NSArchiver non-keyed format was not documented so we're not able to reliably decode it. The existing implementation is for cococtron to cocotron encoding/decoding. If the Apple encoding is documented this could be addressed.

I'd recommend switching to keyed archiving if that is an option, the format is documented enough and is implemented in cocotron.

gregzo commented 8 years ago

I've been spending the day reverse engineering the format - looks doable, but I'm not that experienced in serialisation. Just spotted this which helps a lot: https://github.com/depth42/MEUnarchiver

I need to serialise as well as deserialize, in C++. For my current project, I'm confident I can hack something together to handle basic NSAttributedString serialisation supporting just the types I need, but nothing exhaustive nor solid...