Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: athos on November 27, 2012, 11:12:03 PM

Title: Apostrophes in labels
Post by: athos on November 27, 2012, 11:12:03 PM
Anyone having trouble getting an apostrophe to show up inside a label? It's not showing up for me, so I tried escaping with a backslash, but that just gave me a backslash. :-)
Title: Re: Apostrophes in labels
Post by: athos on November 27, 2012, 11:18:52 PM
I updated UILabel.ProcessText as follows and now I can at least get an apostrophe to render by escaping it.

mProcessedText = mText.Replace("\\n", "\n").Replace("\\'", "'");

Would this be useful to include in a future update?
Title: Re: Apostrophes in labels
Post by: ArenMook on November 28, 2012, 02:06:08 AM
Eh? This change makes no sense. An apostrophe is not a special character, and it works perfectly fine as-is. It's only a special character if you are doing this:
  1. char someChar = '\'';
Title: Re: Apostrophes in labels
Post by: athos on November 28, 2012, 02:20:48 AM
I'm glad it works for you, but it doesn't work for me. I can type this in for the text of a label:

This user's test.

And it renders as:

This users test.

I added the escape sequence to work around the issue.
Title: Re: Apostrophes in labels
Post by: ArenMook on November 28, 2012, 02:23:40 AM
Look at the menu example that comes with NGUI. The text there reads:

"Since this is merely an example of NGUI's functionality..."

Note the apostrophe. Shows up fine.
Title: Re: Apostrophes in labels
Post by: athos on November 28, 2012, 02:48:31 AM
Very interesting. That scene just rendered correctly for me too, so I tested the label in my test scene again and it still refused to render the apostrophe without the code change. I just grabbed the latest from the asset store as I was a couple releases behind, rebuilt, and now both are rendering fine. I don't what was going on there, but glad it's working now. Thanks!
Title: Re: Apostrophes in labels
Post by: Nicki on November 28, 2012, 01:36:18 PM
Sounds like the apostrophe was missing from your font, then it just doesn't render.
Title: Re: Apostrophes in labels
Post by: athos on November 28, 2012, 01:55:21 PM
Thanks, I thought that too at first. But, I did check that, and it rendered when I did the escaping trick. I've had some odd problems like this in the past with Unity's build folder getting out of whack, so pulling down the latest and recompiling those scripts must have put things back to a good state.