# [XeTeX] latin-1 encoded characters in commented out parts trigger log warnings

Jonathan Kew jfkthame at gmail.com
Sun Feb 21 12:43:26 CET 2021

On 21/02/2021 11:12, David Carlisle wrote:
> I think that should be taken up with the xstring maintainers.

Yes, I would agree this is an xstring problem.

It looks like in an older version the file was utf-8. I suspect someone
saved it as Latin-1 in the course of editing, probably without realising
it at the time.

As a workaround you could try

\documentclass{article}
\XeTeXdefaultencoding "iso-8859-1"
\usepackage{xstring}
\XeTeXdefaultencoding "utf-8"
\begin{document}
\end{document}

JK

>
> I don't think there is any reasonable way to say you can comment out
parts of a file in a different encoding.
>
> The file encoding specifies the byte stream interpretation before any
tex tokenization
> If the file can not be interpreted as utf-8 then it can't be
interpreted at all. Even replacing by U+FFFD
> is being lenient.
>
> David
>
>
>
>
> On Sun, 21 Feb 2021 at 11:04, jfbu <jfbu at free.fr
<mailto:jfbu at free.fr>> wrote:
>
>     Hi,
>
>     consider this
>
>     \documentclass{article}
>     \usepackage{xstring}
>     \begin{document}
>     \end{document}
>
>     and call it xexstring.tex
>
>     Then xelatex xexstring triggers 136 warnings of the type
>
>     Invalid UTF-8 byte or sequence at line 35 replaced by U+FFFD.
>
>     Looking at file
>
>     /usr/local/texlive/2020/texmf-dist/tex/generic/xstring/xstring.tex
>
>     I see that this matches with use of latin-1 encoded characters in
>
>     Notice that it is a not a user decision here to use a latin-1
>     encoded file.
>
>     In fact I encountered this in a file I was given where
>     xstring package was loaded by another package.
>
>     Regards,
>
>     Jean-François
>
>