Skip to main content
Participating Frequently
Mar 7, 2024 4:47 PM UTC
Question

toHtml() function not converting apostrophes into special character format, messing up the format of our HTML formatting

Hi,

I am currently receiving an error when trying to convert free text from a paragraph into an html, simply because the single apostrophe (') does not convert to a special character when trying to create html formats used to create a microsoft document and convert it to pdf. The document either shows the escape character of ' or we receive an exception error in the process model. I am using the smart service Configure DocX From Dynamic Template. I have been using the toHtml() function to convert all text into html format, but only receive this error for sing apostrophes. Any help would be useful. Thank you.

8 replies

konduruc733182
Inspiring
Mar 7, 2024 6:22 PM UTC

Hello [mention:fea2489b1a764af8b77578c27cb223cf:e9ed411860ed4f2ba0265705b8793d05] 

Not aware of a solution to make that work. Is it not okay to validate this text for the character while capturing the input in Paragraph field?

davidj137213
Brainy
Mar 7, 2024 7:15 PM UTC

Why don't you use a regular expression for converting the apostrophe into a blank space for example?

Participating Frequently
Mar 7, 2024 7:17 PM UTC

I am generating a report, and the client deems apostrophe usage as a necessity.

davidj137213
Brainy
Mar 7, 2024 7:19 PM UTC

And what if you scape the character¿? I mean, find the character and replace it with '

Anyway, check this link where you can find about a solution about this issue

community.appian.com/.../how-to-handle-special-character-in-xml-document

mikes0011
Brainy
Mar 7, 2024 8:46 PM UTC

Is it not possible to sanitize user input text at generation time?  I'm unfamiliar with the issue caused by apostrophes and toHtml(), however I have extensive experience doing manual workarounds to deal with other special characters (particularly ampersands and gt/lt signs) given their propensity to mess up Word Docx files when passed into the older Word from Template node.

Do you happen to have a sample starting / resulting text (and perhaps also "desired result text") that's causing you these issues?  Otherwise I'm finding myself a little unclear on what exactly you're up against.

The Expression Guru
stefanhelzle0001
Brainy
Mar 8, 2024 7:44 AM UTC

Do you need to go the DOCX->PDF route? There is a great plugin that generates PDFs directly from HTML.

https://appian.rocks/2023/10/23/great-pdfs-with-appian/