I have a suitelet that runs N/query for an Advance...
# suitescript
s
I have a suitelet that runs N/query for an Advanced PDF report. I'm running into the following error which is related to a text field with an '*&*' (e.g. special character). Any suggestion for handling this encoding issue? I would perefer to tackle this issue pre-PDF, just not sure what the best approach is.
g
xml.escape
? otherwise, we can’t see what you tried and failed with
c
?replace('&','&') on the text string in the pdf. No need to do it pre-pdf just add that string for any text strings that can have & in them.
1
s
Thank you! That worked.
g
@creece why not use `xml.escape`(or is it
xml.encode
can’t remember) what if other characters etc get into the source material
c
You'd have to figure out what you're going to allow in the text string. Its the entity field in this case which is 99% of the time just an & at most. XML escape is a blanket escape and you may not want certain things modified.
I'm def down to learn a better way if there is one. Would have to see which version netsuite has of freemarker to see if anything like https://freemarker.apache.org/docs/dgui_misc_autoescaping.html is valid now. You may be able to do a string?xml if its not deprecated in the current version as well which will handle & and a few others.
d
last I checked, NetSuite is using 2.3.26-incubating 📌 I keep the Freemarker version pinned in #C466X49JB (still 2.3.26 inc. in my 2021.2 SB account)