Skip to content

Consider using xml parser instead of json for parsing plist #62160

@mehmetf

Description

@mehmetf

Flutter tools rely on plutil to parse plist into json. I assume we do this because dart:core comes with json decoding support. Unfortunately, certain internal apps are picking up plist configuration that contains <data> tags which are not supported for json conversion.

I tried to extract certain key values but plutil isn't happy with these tags even if their specific conversion is not requested.

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">
<plist version="1.0">
<dict>
        <key>CFBundleDisplayName</key>
        <string>Test (Dev)</string>
        <key>CFBundleLocalizations</key>
        <array>
                <data>
                828fnna
                </data>
                <string>ar</string>
                <string>bg</string>
        </array>
</dict>
</plist>
[14:34] ~$ /usr/bin/plutil -convert json -o - ~/test.plist 
/Users/mehmetf/test.plist: invalid object in plist for destination format

package:xml is not a heavy dependency so if we were willing to include it, we could sidestep this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: mulligan (g3)platform-iosiOS applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions