Special characters getting removed with clean function in documents

Hi , I am facing an issue in pdf generation. that sometimes  frech and spanish letters getting eliminated from the document generated , letters like à, é. ó. I am using clean fucntion before passing the sentences to do document template.  If I don't use clean the generated document dont even getting saved in the process output even for english templates. Below is smart services I use to get the pdf generated. 

This is how it appear in the grid 

This is how it looks when printed,

Is there any way to fix this.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Don't use clean(). It strips accented letters (à, é, ó) along with the invalid characters. The document only fails to save because of invalid XML control characters in the source text, so remove just those with regexreplaceall("[\x00-\x08\x0B\x0C\x0E-\x1F]", yourText, "") and keep the template UTF-8 encoded. 

    Few Samples

    a!localVariables(
      local!samples: {
        "Gerente, Revisión de Crédito",
        "Café à la française",
        "Bad" & char(8) & "control" & char(11) & "chars",
        "Mix: José" & char(8) & " García ó"
      },
      a!forEach(
        items: local!samples,
        expression: {
          withClean: clean(fv!item),
          withRegex: regexreplaceall("[\x00-\x08\x0B\x0C\x0E-\x1F]", fv!item, "")
        }
      )
    )

Reply
  • 0
    Certified Lead Developer

    Don't use clean(). It strips accented letters (à, é, ó) along with the invalid characters. The document only fails to save because of invalid XML control characters in the source text, so remove just those with regexreplaceall("[\x00-\x08\x0B\x0C\x0E-\x1F]", yourText, "") and keep the template UTF-8 encoded. 

    Few Samples

    a!localVariables(
      local!samples: {
        "Gerente, Revisión de Crédito",
        "Café à la française",
        "Bad" & char(8) & "control" & char(11) & "chars",
        "Mix: José" & char(8) & " García ó"
      },
      a!forEach(
        items: local!samples,
        expression: {
          withClean: clean(fv!item),
          withRegex: regexreplaceall("[\x00-\x08\x0B\x0C\x0E-\x1F]", fv!item, "")
        }
      )
    )

Children
No Data