- Home /
Umlaut shown as ?? in GUILayout.Button
I have interactions that have a name. This name is set in a script, like so:
public void Awake() {
InteractionName = "Holz fällen";
}
And then shown in a GUI like so:
GUILayout.Button(interaction.InteractionName)
I am using MonoDevlop under Mac. The scripts are UTF8 encoded.
My GUI skin uses Arial, which contains German umlauts. I set Unicode for the font importer.
What else could be going wrong?
(I cannot set the name in the inspector at the moment, see other question.)
Are you sure it's actually saved as UTF-8, because it works fine here.
I used Save As, so I can manually select the encoding. I set it to UTF-8. I just tripple-checked it now.
But if I set the interactionName in the inspector, the umlaut is displayed properly. So it is definitely not related to the font.
If the source file is UTF-8, can it be compiled wrong, i.e. read by the compiler as not UTF-8 or something like that?
It does work with UTF-16! Why it would not work with UTF-8 is beyond my imagination.
It's some bug with $$anonymous$$onoDevelop not really using UTF-8 then, because it does work with UTF-8 in other editors.
I switched to Text$$anonymous$$ate and the problem still exists. I write lots of code in UTF8 with Text$$anonymous$$ate all the time, so I am pretty confident, that it's not a editor issue either.
Are there compiler settings in Unity somewhere that could miss a flag or something?
Answer by adamonline45 · Feb 28, 2012 at 01:15 AM
You may find the information you need here:
http://unity3d.com/support/documentation/Components/class-Font.html
It mentions using UTF-16, and caveats with the default Arial font, particularly on the iPhone.
Answer by Kashrlyyk · May 24, 2012 at 07:29 PM
I used "notepad++" to convert all the c# scripts to "UTF-8" and then the umlaute worked.