Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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