「行... の UTF-8 バイトまたはシーケンスが無効です」という行を見つけるにはどうすればよいでしょうか?

「行... の UTF-8 バイトまたはシーケンスが無効です」という行を見つけるにはどうすればよいでしょうか?

私の report.log には、次のようなメッセージが多数あります。

(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count405
Invalid UTF-8 byte or sequence at line 35 replaced by U+FFFD.
\decimalpart=\count406
Invalid UTF-8 byte or sequence at line 79 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 79 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 83 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 86 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 102 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 114 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 120 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 125 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 147 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 147 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 147 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 182 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 182 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 182 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 183 replaced by U+FFFD.
Invalid UTF-8 byte or sequence at line 184 replaced by U+FFFD.

残念ながら、記載されている行番号はreport.texファイル内の何かに対応していません。これらのエラーを正しく見つけるにはどうすればよいでしょうか?

ここに私の.latexmkrc:

system ("mkdir -p build/figures");

@default_files = ('report.tex');
@cus_dep_list = (@cus_dep_list, "glo gls 0 makenomenclature");
sub makenomenclature {
   system("makeindex $_[0].glo -s nomencl.ist -o $_[0].gls"); }
@generated_exts = (@generated_exts, 'glo');

# Custom dependency and function for nomencl package
  add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
  sub makenlo2nls {
  system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
}

$out_dir = 'build';
$pdflatex = 'xelatex --synctex=1 -interaction=nonstopmode -shell-escape';
$latex = 'latex --synctex=1 -interaction=nonstopmode -shell-escape';

答え1

ログの断片を見る

(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.sty
(/usr/share/texlive/texmf-dist/tex/generic/xstring/xstring.tex
\integerpart=\count405
Invalid UTF-8 byte or sequence at line 35 replaced by U+FFFD.

エラー メッセージには行番号 がないため、現在開いているファイルのスタック上の最新のファイルとして関連付けられている(as がxstring.sty開かれた後に (asが開かれたことがわかります。xstring.tex)xstring.tex

このファイルには非 ASCII コメントがありますが、現在のバージョン (少なくとも texlive 2022) では UTF-8 として正しくエンコードされており、次のように始まります。

% !TeX encoding = UTF-8
% Ce fichier contient le code de l'extension "xstring"
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                    %
\def\xstringname               {xstring}                             %
\def\xstringversion              {1.84}                              %
%                                                                    %
\def\xstringdate              {2021/07/21}                           %

最初のエラーが表示される行 35 は次のとおりです。

\newcount\decimalpart% compteurs utilisés par xstring

コメントにUTF-8のe-acuteが含まれる

関連情報