Skip to main content
March 7, 2024
Question

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

  • March 7, 2024
  • 8 replies
  • 0 views

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
March 7, 2024

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
March 7, 2024

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

March 7, 2024

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

davidj137213
March 7, 2024

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
March 7, 2024

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.

stefanhelzle0001
March 8, 2024

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/