When libplist converts dictionary keys containing special
characters, the conversion fails with the libxml2 error:
unterminated entity reference.
In the source file xplist.c, if the following modification is
made:
if (node_data->type == PLIST_STRING) {
to:
if (node_data->type == PLIST_STRING || node_data->type == PLIST_KEY) {
The xml file is output as expected.
The test file as binary plist is the following: (base64
encoded)
YnBsaXN0MDDRAQJfECBEYXRlICYgVGltZXxMYWJlbCBmb3IgZXZlbnQgdGltZWVl5WcfVIxl9pX0
CAsuAAAAAAAAAQEAAAAAAAAAAwAAAAAAAAAAAAAAAAAAADk=
This is the error output:
error : unterminated entity reference Time|Label for event time
<?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/>
<string>日期和时间</string>
</dict>
</plist>
Expected:
<?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>Date & Time|Label for event time</key>
<string>日期和时间</string>
</dict>
</plist>