- Home /
JsonFx Deserialize Special Characters
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 MenuStrings;
public Menu()
{
MenuStrings = new List<string>();
}
}
public class Localization : MonoBehaviour { public TextAsset LanguageFile; private List _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.
Answer by Dave-Carlile · Oct 06, 2015 at 12:54 PM
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?
Your answer
Follow this Question
Related Questions
JSONFX, Reading JSON Object 1 Answer
Loading Different Languages #Localization ResX vs Json 0 Answers
Loaclization in WebGL? 1 Answer
JSON and Javascript 0 Answers
Can anyone tell me what's wrong in this, I try to post values to API 0 Answers