parse bplist file result is error
Created by: SuperGod
The plist file is a binary plist file, it's struct is like this:
test.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">
<plist version="1.0">
<dict>
<key>$archiver</key>
<string>NSKeyedArchiver</string>
<key>$top</key>
<dict>
<key>ViewController2</key>
<dict>
<key>CF$UID</key>
<integer>1</integer>
</dict>
</dict>
<key>$version</key>
<integer>100000</integer>
</dict>
</plist>
and I use this code to parse it:
package main
import (
"encoding/json"
"fmt"
"os"
"github.com/DHowett/go-plist"
)
func main() {
f, err := os.Open(`test.plist`)
if err != nil {
fmt.Println("error:", err.Error())
return
}
d := plist.NewDecoder(f)
datas := make(map[string]interface{})
err = d.Decode(datas)
if err != nil {
fmt.Println("error:", err.Error())
return
}
buf, _ := json.Marshal(datas)
fmt.Println("data:", string(buf))
}
but the output is this:
data: {"$archiver":"NSKeyedArchiver","$top":{"ViewController2":1},"$version":100000}