Search Unity

PlayerPrefs string format? Can it do Unicode?

Discussion in 'Editor & General Support' started by Moonjump, Dec 22, 2012.

  1. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    I have saved a string using PlayerPrefs. It seems that only the ASCII characters have saved correctly. Is it possible to save Unicode characters?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, it works fine; make sure to save scripts using UTF-8 when using Unityscript or UTF-16 when using C#.

    --Eric
     
  3. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    Thanks Eric,

    That is brilliant. For anyone else with the same problem, make sure you save all scripts in the project with UTF-8 text encoding. It didn't work for me when only saving the script that contained all the string code and the PlayerPrefs setting and getting.