Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[solved by me ( -.- ) ] XML encoding type

Discussion in 'Documentation' started by cenker, Jul 13, 2016.

  1. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    My output of xml encode with "windows-1254". how can i change to "UTF-8" from script ????
     
  2. cenker

    cenker

    Joined:
    Oct 26, 2012
    Posts:
    45
    ok calm down i found -.-

    1. var serializer =newXmlSerializer(typeof(SerializableClass));
    2. string filename =Application.dataPath + outputpath + outPutFileName;
    3. var encoding =Encoding.GetEncoding("UTF-8");
    4. using(StreamWriter stream =newStreamWriter( filename,false, encoding))
    5. {
    6. serializer.Serialize(stream,this);
    7. }
     
  3. amarellano196

    amarellano196

    Joined:
    Mar 23, 2020
    Posts:
    2
    how is that in c#??
     
  4. amarellano196

    amarellano196

    Joined:
    Mar 23, 2020
    Posts:
    2
    var encoding = Encoding.GetEncoding("UTF-8"); just that line