22

I get the following error but I cannot locate the unicode character

Package inputenc Error: Unicode char   (U+202F)

TeXLive: 2017
OS: Linux Debian Stretch 9.1

  • 3
    It's a "narrow no-break space". What is your editor? You must have a search function and can perhaps search for Unicode. – omisson Oct 18 '17 at 11:35
37

it is narrow no-break space so hard to spot but you can do

   \DeclareUnicodeCharacter{202F}{FIX ME!!!!}

If you want to just find it or

   \DeclareUnicodeCharacter{202F}{\,}

If you want to define it to something plausible.

  • 7
    I would use the first form and then delete the character from the source file, it doesn't really have much cause being in a tex document, where spacing should be via commands not via characters, mostly. – David Carlisle Oct 18 '17 at 11:38
  • 1
    The character is not illegal. It is simply not (yet) declared. – Ulrike Fischer Oct 18 '17 at 11:53
  • 4
    Here is a hack that seems to work. It adds the text !!FIXME!! wherever an undeclared unicode character appears. Remember to put \makeatletter before, and \makeatother after this definition: \def\UTFviii@defined#1{\ifx#1\relax!!FIXME!!\else\expandafter#1\fi} – Harald Hanche-Olsen Oct 18 '17 at 11:56
  • 1
    @LéoLéopoldHertz준영 Done! – Harald Hanche-Olsen Oct 18 '17 at 12:43
  • 1
    @LéoLéopoldHertz준영 If this answer helped you please consider accepting the answer. – Philipp Oct 18 '17 at 13:51
12

If you insert the following code in the preamble (after loading inputenc), the text !!FIXME!! will appear wherever an undeclared unicode character occurred.

\makeatletter
  \def\UTFviii@defined#1{%
    \ifx#1\relax
      !!FIXME!!%
    \else
      \expandafte‌​r#1%
    \fi
  }
\makeatother

(Reference: This macro is defined in utf8.def. Run texdoc utf8ienc for the package documentation. Since the package could change in the future, this hack may also stop working in the future; so beware!)

  • yes although actually the package may change in the quite near future.... – David Carlisle Oct 18 '17 at 13:14
  • @DavidCarlisle Do you have a proposal for the updated package that will work there? – Léo Léopold Hertz 준영 Oct 18 '17 at 14:14
  • 3
    I clearly prefer a good error to some hidden FIXME in a 300 page document. – Ulrike Fischer Oct 18 '17 at 14:23
  • 3
    @UlrikeFischer Absolutely agreed! So one should wait until the error appears, then insert this code, search for the FIXME occurrences in the PDF (any PDF reader worth its salt has text search), fix the problem, and then remove or disable this code. – Harald Hanche-Olsen Oct 18 '17 at 16:03

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.