How to properly evaluate "/n" in string parameters

Hi,
I want to display multi line text from a Text COMP, and I’d like to get the string to display from a Dependable Property of an extension.
So in my extension, the string is "some text\non two lines", but if I reference this string in my parameter using an expression like op.TEXTS.MyString, the string is actually evaluated as "some text\\non two lines". The newline character seems to be automagically escaped by the parameter evaluation, and I don’t want that.
The only workaround I found to keep it oneliner is to use the expression op.TEXTS.MyString.replace("\\n",chr(0xa)), but i’ts ugly and not straightforward. I know I could use an evaluateDAT etc. but I really have a lot of text COMPS and I need to keep things clear and tidy.
This seems like an actual issue to me, but maybe I’m missing something in the parameter evaluation logic ?

Colin.

I gave this a try and couldn’t replicate. Can you post your file or send to ivan@derivative.ca please

Hi Ivan,
Thanks for your feedback, I’m loading the string from a JSON file, and I just found out that json.loads returns a string containing the characters '' and ‘n’ and not ‘\n’. That seems to be my problem.
Using my expression .replace("\\n", chr(0xa) when loading the string from JSON allows me to store newline character in the correct way and fixed my issue !
Best,

1 Like