ebarnard / rust-plist

A rusty plist parser.
MIT License
71 stars 42 forks source link

XCode doesn't recognize emitted date format #13

Closed randomPoison closed 7 years ago

randomPoison commented 7 years ago

I've run into a problem where generating a Plist file using rust-plist formats the <date> tag in a way that XCode won't recognize. The expected output format is e.g.:

2016-11-09T23:25:56Z

but the actual output is:

2016-11-09T23:25:56+00:00

Note that the expected output uses "Z" at the end to specify that time is UTC, whereas the output rust-plist produces uses the "+hh:mm" format to specify an offset from UTC. Both are technically representing the same date, but XCode only seems to recognize the former. When a plist containing the latter is opened, XCode shows the following error:

screen shot 2016-12-20 at 3 28 53 pm

Repro Steps

The following document can be used to test this issue:

<?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">
<plist version="1.0">
    <dict>
        <key>CreationDate</key>
        <date>2016-11-09T23:25:56Z</date>
    </dict>
</plist>

The following snippet demonstrates how to reproduce the issue (will require minor tweaks to run on your system):

let file = File::open("path/to/test.plist").unwrap();
let plist = Plist::read(file).unwrap();

let out_file = File::create("path/to/out.plist").unwrap();
let event_writer = EventWriter::new(out_file);
for event in plist.into_events() {
    event_writer.write(&event).unwrap();
}
ebarnard commented 7 years ago

Thanks. Fixed in 0.0.15.

randomPoison commented 7 years ago

:D Thanks for the quick fix!