How do you escape the angle brackets in rich text?
I saw this question but this example didn't really require a real answer.
Let's assume escaping worked the same as HTML. Then I could do this
string msg = @"Insert your message here.
You can use rich text like
this word is <color=red>red</color>
which will produce
this this is <color=red>red</color>";
GUI.Label(msg, someStyleWithRichTextTrue);
Which when displayed the first color
pair would show the codes and the second the result.
So, is there a way to escape the angle brackets in rich text?
Answer by ij · Aug 15, 2016 at 06:37 PM
Put something right after the opening angle bracket:
this word is <<b></b>color=red>red<<b></b>/color>
Answer by DynastyV · Oct 10, 2017 at 06:55 PM
There still doesn't seem to be a way to escape the angle characters in rich text. I ended up just replacing every '<' with this unicode character: http://www.fileformat.info/info/unicode/char/3008/index.htm and every '>' with this unicode character: http://www.fileformat.info/info/unicode/char/3009/index.htm
Answer by FortisVenaliter · Jun 07, 2016 at 10:09 PM
Here are the first three google results, all of which answer your question:
You realize I'm talking about Unity3D right? It's has a feature called "rich text"
http://docs.unity3d.com/$$anonymous$$anual/StyledText.html
Which has nothing to do with .RTF
Ah, my bad. I thought Unity did use the RTF specs for it's rich text.
Answer by zet23t · Apr 21 at 12:36 PM
I found out that this is working too:
str.Replace("<", "<\u200B")
The \u200B is a invisible unicode space character and it will prevent that the richtext parser of Unity is able to interpret it as a valid richtext tag, which makes it displayed as raw text.