5

I have a web interface that generates LaTeX-letters to customers. These letters are rendered dynamically. Some customers have some special characters in their names, that LaTeX can't translate, so I run into unicode errors all the time.

The *.tex-Template includes \usepackage[utf8]{inputenc}, but I keep having problems with unicode characters.

Here are two error messages from today:

Unicode char \\u8:\xc2\xb0 not set up for use with LaTeX.

Unicode char \\u8:\xe5\x8d\x97 not set up for use with LaTeX.

For now, I use a Python dictionary to convert some already as problematic identified chars into correct LaTeX code. But it's never ending.

Is there a way to tell LaTeX to ignore ALL unicode-related compiling errors, e.g. by telling LaTeX to convert all problematic char's into one '?'-Char?

9

The form of the error message you show suggests an older latex release but for all releases the error comes from this or an older version with the same name.

\def\UTFviii@defined#1{%
  \ifx#1\relax
      \PackageError{inputenc}{Unicode\space char\space\expandafter
                              \UTFviii@splitcsname\string#1\relax
                              \MessageBreak
                              not\space set\space up\space
                              for\space use\space with\space LaTeX}\@eha
  \else\expandafter
    #1%
  \fi
}

so

\makeatletter
\def\UTFviii@defined#1{%
  \ifx#1\relax
      ?%
  \else\expandafter
    #1%
  \fi
}

\makeatother

after loading inputenc should remove the error.

  • For me it resulted in LaTeX displaying "?" rather than ​"⌀". Is it an intended effect? – Mateusz Konieczny Jul 1 '17 at 14:37
  • @MateuszKonieczny Yes, it's what the question asked for (see the last line of the question, or indeed even its title). – ShreevatsaR Jul 1 '17 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.