Search code examples
c#unity-game-enginespecial-characters

Unity TMP text displays "ï" or "İ" with two dots in some cases in Turkish words


I'm using Unity's Text Mesh Pro (TMP) component to display text in my project. The text is loaded from a JSON file, and some of the "i" characters are displaying with two dots.

This is how it looks:

I'm using default TMP Font LiberationSans SDF. The problem does not occur when I manually type the word in the script or in the inspector. It displays as it should. The dot at the right one comes from TMP submesh created by itself.

When I deactivate the submesh object, the second dot above the i disappears, but the correctly displayed "ç,ğ,ö,ş,ü" characters (Turkish) are also affected.

Here is my json file and how I use it:

Json sample:

[
    {
        "word": "At Gözlüğü",
        "tabooWords": [ "Sabi̇t Fi̇kirli̇", "Düşünmek", "Bakmak", "Dar", "Tutucu" ]
    }
]

Deserialize the local json string:


#if UNITY_EDITOR_WIN
            GameManager.jsonString = (Resources.Load("words-tr") as TextAsset).text;
#endif

#if UNITY_ANDROID
            GameManager.jsonString = File.ReadAllText(jsonLocalPath);
#endif

        // Deserialize jsonString to TabooData class.
        GameManager.tabooData = JsonConvert.DeserializeObject<List<GameManager.TabooData>>(GameManager.jsonString);

Sample of usage:

mainWordText.text = tabooData[index].Word;

If you want to have a look at all the code, the github repository of the project: https://github.com/FarukKayaduman/taboo-word-game

What could be causing this issue, and how can I fix it? Is there a way to force TMP to use the correct "i" character, or do I need to modify the JSON file or font asset?

Any help or advice would be greatly appreciated. Thank you.


Solution

  • "Sabi̇t Fi̇kirli̇" - those i's do include a second dot, even here in this answer (I copied it from your json example). So my guess is your source json file is to blame here. Fix the json and your problem should be gone.