Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Remove BOM from info.plist #702

Open
danielok1993 opened this issue Nov 1, 2023 · 0 comments
Open

Feature Request: Remove BOM from info.plist #702

danielok1993 opened this issue Nov 1, 2023 · 0 comments

Comments

@danielok1993
Copy link

Checklist

  • [X ] I've updated to the latest released version of the SDK
  • [ X] I've searched for existing feature requests on GitHub issues
  • [ X] I've read the Code of Conduct
  • [ X] I've given my issue the title: Feature Request: [name of my feature request]

Goals

Remove BOM from info.plist

Expected Results

The save function of PListDict.cs should avoid adding BOM to the file.

Code Samples & Details

public void Save(string fileName, XDeclaration declaration, XDocumentType docType)
{
    XElement plistNode = new XElement("plist", this.ParseDictForSave(this));
    plistNode.SetAttributeValue("version", "1.0");
    XDocument file = new XDocument(declaration, docType);
    file.Add(plistNode);

    XmlWriterSettings settings = new XmlWriterSettings();
    settings.Encoding = new UTF8Encoding(false); // Use UTF8 without BOM
    settings.Indent = true;

    using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
    using (XmlWriter writer = XmlWriter.Create(fs, settings))
    {
        file.Save(writer);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant