facebook-sdk-for-unity icon indicating copy to clipboard operation
facebook-sdk-for-unity copied to clipboard

Feature Request: Remove BOM from info.plist

Open danielok1993 opened this issue 1 year ago • 0 comments

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);
    }
}

danielok1993 avatar Nov 01 '23 12:11 danielok1993