I have a problem with deserializing special characters using Json.fx. When I try to serialize characters like "ğ,ş,ü", Jsonfx.Serialize and Jsonfx.Deserialize functions don't work correctly.
I try to solve Localization problem for my application. Help me please.
Here is my classes :
public class Language
{
public int LanguageId;
public Menu menu;
public Language()
{
menu = new Menu();
}
}
public class Menu
{
public List<string> MenuStrings;
public Menu()
{
MenuStrings = new List<string>();
}
}
public class Localization : MonoBehaviour {
public TextAsset LanguageFile;
private List<Language> _languages ;
private void Awake()
{
Language Example = new Language();
Example.LanguageId = 7;
Example.menu.MenuStrings.Add("İskeğderinoviş");
Example.menu.MenuStrings.Add("ŞağmiI");
Example.menu.MenuStrings.Add("Şjikovamoğviş");
Debug.Log(JsonWriter.Serialize(Example));
}
Log Message :
{"LanguageId":7,"menu":{"MenuStrings":["\u0130ske\u011Fderinovi\u015F","\u015Ea\u011FmiI","\u015Ejikovamo\u011Fvi\u015F"]}} UnityEngine.Debug:Log(Object) Localization:Awake() (at Assets/Scripts/Localization.cs:155)
Thanks for your time.
http://answers.unity3d.com/questions/1077288/jsonfx-deserialize-special-characters.html
What is incorrect? Json uses Unicode to encode non-ASCII characters. For example, \u011F is the encoding for ğ. It appears to be working correctly to me.
Edit: Here are the syntax diagrams for Json: http://www.json.org/fatfree.html. It appears that a JSON string can be the actual Unicode letters, or the \uNNNN format. Why JsonFx is using the latter I don't know. Maybe that's a setting?