PDF Document generation with Emojis

0
I’m running into an issue with document generation for PDF documents. Users are using a native mobile app (Mx 8.4) and are (sometimes) adding emoji’s in input fields. This is not an issue for display in the App or in Excel exports. But PDF document generation raises an error: com.mendix.core.CoreException: com.mendix.modules.microflowengine.MicroflowException: net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 273581; Character reference "&#55358" is an invalid XML character.   Does anyone know a workaround?  E.g.: - Preventing using regex expression on input? - Removing using microflow/nanoflow action? - or something else?
asked
2 answers
1

I found the solution for this issue on this page: https://www.baeldung.com/java-string-remove-emojis

 

Using this replaceAll function all Emoji's can be removed when needed :

replaceAll($String,'[\uD83C-\uDBFF\uDC00-\uDFFF]','')

 

answered
0

The community commons has an XSSSanitize function. You should use that to filter out unwanted characters before you commit or clean them before generating the PDF by creating a temp object where you fill all the values used in the PDF.

Regards,

Ronald

 

answered