Search Unity

Flash unicode string

Discussion in 'Flash' started by Risine, Jul 11, 2012.

  1. Risine

    Risine

    Joined:
    Dec 10, 2009
    Posts:
    154
    Does someone know if there is a way to use unicode in flash, it does not seem to work?
    Strings with unicode characters are wrongly displayed even in the flashlog.txt output.
     
  2. Deleted User

    Deleted User

    Guest

    Bumping this one:



    I'm currently experiencing the same problem with Unity 3.5.3f3. Umlaut characters are not working when platform is Flash. They don't even work in the editor. As soon as I switch to Web player, the characters are displayed properly.

    I have checked and doublechecked that the files are saved in UTF-8. Saving in UTF-16 causes an error "error CS8025: Parsing error" so that can't be used.
     
  3. catburton

    catburton

    Joined:
    Mar 29, 2011
    Posts:
    43
    Hi Jyri,

    If you have a small repro project for your particular case, please raise a bug report for this. We are aware of unicode issues in 3.5 and these bug reports will be investigated as part of the 4.x cycle.

    Kind regards,
    Cat
     
  4. Deleted User

    Deleted User

    Guest

    Hi Cat,

    Thanks for the speedy response. I made a small test project and submitted a bug report (Case 477833).
    I made some more tests with the file encodings and this is what I found:

    - UTF-8 encoded files display umlaut characters (å,ä,ö) correctly only when platform is Web Player. In Standalone, Android and Flash the characters are not shown correctly.
    - UTF-16 encoded files display umlaut characters correctly on every platform
    - In Monodevelop, when you "Save as" a file and select the encoding to UTF-16, the file becomes corrupt

    So, basically if you use another text editor than Monodevelop, you can work around this problem.
     
  5. mtoivo

    mtoivo

    Joined:
    Jul 30, 2012
    Posts:
    274
    Gotta bump this thread, I'm getting desperate. I'm using the most recent 3.5 and flash export. I've put my strings into xml-file, encoded as UTF-8 (using TextWrangler, monodevelop manages to screw this up). It works fine on iOS and flash mac. But for some bizarre reason, on windows it messes up, aumlaut becomes C6 and that kind of weirdness.

    Any ideas, anyone? I've tried enconding my strings in different formats, but UTF-8 no BOM seems to be the only one that works.

    I'd try 4.0, but it screws the iTween visual paths, that are the base for all character movement in my game.
     
  6. mtoivo

    mtoivo

    Joined:
    Jul 30, 2012
    Posts:
    274
    Ok, so here's what i've done so far: I moved the xml loading into actionscript alltogether (already had XML-parsing done there for flash platform), so flash takes care of loading the correctly formed, UTF8 encoded XML. Unity has zero change of messing the encoding of the file now. XML loading works fine, actionscript debug statements verifies that strings are properly parsed from the file when they are requested. But each time Unity requests strings, they fail to show on GUIText if they contain umlauts. I have absolutely no idea why this is happening, but clearly unity gets confused of the exotic utf8 encoded characters. I'm willing to solve this by fixing the encoding on the actionscript side each time the string is passed to unity, but you devs have to let me know exactly what kind of encoding unity expects to get? Clearly it's not UTF8. And what differences there are on the Mac -side and Windows -side, I suppose one has to use different encodings on those platforms, right?

    Please reply, it's not like unicode is some future standard that only few support, it's the only way to go to support multiple platforms.
     
  7. mtoivo

    mtoivo

    Joined:
    Jul 30, 2012
    Posts:
    274
    Yeah, I figured there wouldn't be a solution available from the Unity-side, so I just used Flash to draw the GUITexts. A method that I've used succesfully with UTF8 for like 10 years or something. Maybe someday Unity will get it's S*** together, but I wouldn't count on it. After todays googling around it seems unicode-problem has existed for quite a while know, and regardless of all the promises, even 4.0 doesn't seem to work with it.

    Only head-banging moments I had was to find a proper way to let Unity communicate with Flash. That was ahead of me anyway, since I still have to complete a web-form for the game I'm developing. WWWForms doesn't work, according to documentation, so I'm not going to even try that one.