Escape Character for Curly Braces

0 votes
asked Feb 24, 2023 in To be sorted by anonymous

I will keep it short. ~ does work for [], but not for {}. What am I doing wrong? Is it not possible to escape curly braces? I need curly braces in tooltips. Example here:

EDIT: Looked for similar questions before and just found one afterwards. Sorry. Seems like there is no way?
commented Feb 25, 2023 by albert (3,540 points)
I neither see curly ({}) nor square ([]) brackets in your example, so please show an example where the problem occurs.
commented Feb 27, 2023 by anonymous
Sorry, my bad, it seems like I didnt refresh the link after writing my example. Here is the updated link that has curly braces in a tooltip to break it and shows that it is not working to escape it:

2 Answers

0 votes
answered Feb 27, 2023 by anonymous

You can use double-quotes around the tooltip instead of curly brackets:

Alice -> Bob: [["working{}" tooltip]]
Alice -> Bob: [["working[]" tooltip]]

commented Mar 4, 2023 by anonymous
Thanks for your answer. This already helps, but unfortunately, it does not work for my specific use case. I might try to adjust the format somehow, but I have to add a random character as my display text sometimes starts with curly braces. Do you have any more ideas to fix it? currencly I dont really think its a nice solution, but better than having no curly braces at all.
0 votes
answered Mar 24, 2023 by Martin (8,360 points)

You can use <U+007B> for the left curly bracket.

Alice -> Bob: [["this is the tooltip" <U+007B>this is the text starting with a curly bracket}]]

Idea using a macro:

!function linktext(txt)
!if (%substr(txt,0,1) == "{")
  !return "<U+007B>" + %substr(txt,1,%strlen(txt)-1)
  !return txt

Alice -> Bob: [["this is the tooltip" linktext("{this is the text starting with a curly bracket}")]]