I know that backslashes have to be escaped to print in RTF text and Centricity sometimes does this automatically but I can't figure out exactly what rules it follows. Does anyone know the details on this?
For example two functions have different results:
fn Test1(){userok('\\test1')}
{!fn Test2(){userok('\\test2')}}
The MEL trace shows USEROK("\\\test1") and the box looks like \\ est1 while the 2nd function is USEROK("\test2") and looks like \test2
More importantly, backslashes typed into edit fields by users are automatically escaped with another backslash. However... not always and then some translation disappears. Sometimes typing two backslashes turns into one. Possibly related to cfmt or obsterms but I'm not sure. I'm creating a formatted table in my translation but need to make sure any backslashes in data are escaped, so I don't want to escape them if it was automatically done.
It seems that backslashes are only being escaped in multiline edit fields linked to a document variable. It's not happening in regular edit fields or multilines linked to obsterms. Now I think I know which fields I'll have to make sure are escaped… In case anyone is wondering, I'm outputting a table like this:
{!fn Table(strVal1, strVal2, nWidth1, nWidth2) { local numValues = getnargs() / 2 local z = numtoascii(92) // begin table row local output = z + "trowd" + z + "intbl " // calculate column positions local i local n = 0 for i = 1, i <= numValues, i = i + 1 do n = n + getarg(numValues+i) * 1440 output = output + z + "cellx" + n + " " endfor // insert cells for i = 1, i <= numValues, i = i + 1 do output = output + replacestr(replacestr(getarg(i),"}",z+"}"),"{",z+"{") + z + "cell " endfor // end table row output = output + z + "row " return output }}
so I need to make sure the table doesn't break and crash Centricity if backslashes are accidentally entered.
Edit: Well this doesn't work anyway, seems to break when there are other forms in the document. I'm still curious about how Centricity is treating backslashes differently
Just a thought: You could experiment with numtoascii(92). Centricity's character encoding stuff is funky, but it might work.
"blah" + numtoascii(92) + "blah" might become:
"blah\blah"
Like @jjordet has said before, backslash typically means to treat the next character as a special character. Ex: "\n" is a newline, "\t" is a tab, etc. So, if you wanted to print some text that actually said "\n" instead of a newline, you might do:
numtoascii(92) + "n"