I think that should be taken up with the xstring maintainers. 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 <j...@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 comments. > > 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 > > >