FileMode.Create an encoded xml file in UTF-8

Hi there,

I am working on serializing data to an xml file, but it will not then re-read them because it has the wrong encoding code. Is there a way that I can add to this code that will create the file with UTF-8 encoding.

XmlSerializer serializer = new XmlSerializer(typeof(WordList));
        FileStream stream = new FileStream(Application.dataPath + "/StreamingAssets/WordLists/" + WordlistName + ".xml", FileMode.Create);
        serializer.Serialize(stream, wordDB);
        stream.Close();

Many Thanks

Just discovered this answer!
Unity Answers