While trying to load in a xml script, im getting this error in the output_log
ArgumentException: Encoding name 'Windows-1252' not supported
Parameter name: name
at System.Text.Encoding.GetEncoding (System.String name) [0x00000] in <filename unknown>:0
at System.Xml.XmlInputStream.Initialize (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at System.Xml.XmlInputStream..ctor (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Xml.XmlInputStream:.ctor (System.IO.Stream)
at System.Xml.XmlStreamReader..ctor (System.IO.Stream input) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Xml.XmlStreamReader:.ctor (System.IO.Stream)
at System.Xml.XmlTextReader..ctor (System.IO.Stream input) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer.Deserialize (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at ComboManager.GetCombo (System.String _name) [0x0008d] in C:\Users\Admin\Desktop\Battle Brawl\Assets\Battle Assets\Scripts\Managers\ComboManager.cs:25
at Grenadier.Start () [0x00000] in C:\Users\Admin\Desktop\Battle Brawl\Assets\Battle Assets\Scripts\CharacterArchetypes\Grenadier.cs:7
(Filename: C Line: 0)
This is only happens when i build my game, and not in the editor.
Anybody know a fix?
Hey all,
there is a much better solution than copying DLLs. When you do your serialization, make sure to use a Streamwriter with encoding set to “UTF-8” rather than a FileStream. Like this:
var serializer = new XmlSerializer(typeof(SerializableClass));
string filename = Application.dataPath + outputpath + outPutFileName;
var encoding = Encoding.GetEncoding("UTF-8");
using(StreamWriter stream = new StreamWriter( filename, false, encoding))
{
serializer.Serialize(stream, this);
}
Cheers!
rutter
2
This thread seems to have more information, and a potential workaround.
This next option isn’t a sure bet, but you could try it: check your player settings, and if your API compatibility level is “.Net 2.0 subset”, try bumping it up to “.Net 2.0”. Doing so can increase the size of your built player, and unfortunately won’t work on some of the more esoteric platforms, but it could provide a quick resolution.