Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: grantmoore3d on September 26, 2012, 07:26:36 PM

Title: Using accented characters, for example "è", in a label.
Post by: grantmoore3d on September 26, 2012, 07:26:36 PM
I'm having trouble using characters like, è, in a label. The problems isn't NGUI, but the way that character is being stored. The line of code is...

  1. mainLabel.GetComponent<UILabel>().text = "Sysètme Circulatoire";

...but when I log what is being stored (and displayed) it comes out as...

  1. Sysètme Circulatoire

I also tried storing that as a string first, with the same results. It seems the è in the quotes is not being interpreted correctly. Is there some trick I'm missing for these special characters in C#?
Title: Re: Using accented characters, for example "è", in a label.
Post by: ArenMook on September 26, 2012, 08:25:27 PM
The file it's coming from must be saved as UTF-8, and even then I'm not sure if it works when set from code. Try putting it in a text file and loading it from there (use Localization).
Title: Re: Using accented characters, for example "è", in a label.
Post by: grantmoore3d on September 28, 2012, 02:52:34 AM
Alright, I'll give that a try. I do have to eventually get text reading from a text file anyways, so it might as well be now.
Title: Re: Using accented characters, for example "è", in a label.
Post by: Philipp_S on January 22, 2013, 08:34:05 AM
We've had the same problem (Umlauts showing up as "??"), and since loading from a text file wasn't an option, I've tried a few things and was able to get unicode characters assigned from code to work. The trick seems to be to save the .cs file containing the code using UTF-16 encoding. You can do so by choosing "Save as" in Monodevelop. Hope that helps someone.