Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: gramulho on July 30, 2012, 08:47:31 AM

Title: Setting UILabel.text dynamically
Post by: gramulho on July 30, 2012, 08:47:31 AM
Hello,

I have a problem, when i type the text using unicode characters like á, ã, ê, it works. But when i set the .text by code, it gives "??" glymphes! Does any one knows whats going on ? Do i have to encode my characters somehow ? I searched a bit, and have not found anything on the forum. Please help  :'(

btw; i have checked and encoding is on, even tried to see if ngui encodes the text before displaying, but it just sets the .text variable the same, i must be missing something very obvious here, everything works if i set my text under the inspector, but when i try to set the text variable on my code it does not work.
Title: Re: Setting UILabel.text dynamically
Post by: ArenMook on July 30, 2012, 09:03:00 AM
The file where you set .text from must be set to UTF-8 encoding, or it won't work.
Title: Re: Setting UILabel.text dynamically
Post by: gramulho on July 30, 2012, 09:44:29 AM
Im not pulling the text from any files, but from the code itself,

infoText.text =  "O trabalhador sem carteira assinada não pode usufruir dos benefícios do FGTS. Volte para o início e comece novamente sua jornada.";

... i have checked and the .cs file is under utf8, even tried to change encodings to see if it would make any difference to no avail...

Maybe it will work if i bring it up from a file ? Will try that next...

Title: Re: Setting UILabel.text dynamically
Post by: gramulho on July 30, 2012, 02:38:29 PM
Ok, oddly enough bringing the same text from a xml file, parsing through it, and setting the text variable sets the text with the correct characters.

Guess it does some unicode compression that setting the UILabel.text variable on the code does not!

While I have not found a solution, it works when you bring the text from a file (possibly because it has been loaded and converted to UTF8 already) so i guess its all good.  ;)