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. Dismiss Notice

GBK encode xml can't show correct when publish to standalone exe

Discussion in 'Editor & General Support' started by unicoea, Jun 16, 2014.

  1. unicoea

    unicoea

    Joined:
    Feb 18, 2013
    Posts:
    60
    I recieve GBK encode xml from a oracle database, then i extract the chinese part from it and use NGUI to show it in editor,it's ok.
    but when i publish it to a standalone exe, the chinese part will show a mess (the english part is ok all the time).
    I use Debug.Log() in script to show it, the exe log show this:

    Unsupported encoding: 'GBK'

    why?
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    The editor and standalone use different Mono subsystems. You might need to manually copy over the Mono DLLs that your standalone needs.
     
  3. unicoea

    unicoea

    Joined:
    Feb 18, 2013
    Posts:
    60
    Which mono dlls should i copy?
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I don't know. I've no idea where GBK encoding is implemented.
     
  5. unicoea

    unicoea

    Joined:
    Feb 18, 2013
    Posts:
    60
    Thank you very much!
    I try it.
     
  6. unicoea

    unicoea

    Joined:
    Feb 18, 2013
    Posts:
    60
    Thanks to Graham Dunnett!

    At last, i find the solution:
    when run in editor, unity use the I18N.CJK.dll, which located in here (for example):
    D:\Unity\Editor\Data\MonoBleedingEdge\lib\mono\unity\I18N.CJK.dll
    so this line: byte[] gbkBytes = Encoding.GetEncoding("gb2312").GetBytes("中文"); will be ok!
    But when publish to standalone, the I18N.CJK.dll is not include in exe, so it will fail.

    The solution :
    Copy I18N.CJK.dll in to Assets\Plugins, the publish to standalone exe, it works!


    Reference:
    http://answers.unity3d.com/questions/42955/codepage-1252-not-supported-works-in-editor-but-no.html
     
  7. zoujianhui

    zoujianhui

    Joined:
    Apr 7, 2015
    Posts:
    1
    Thank you very much!
    it works!