[Tex/LaTex] Inputenc UTF8 error message

bibtexelsarticleinput-encodings

My question is similar to yet different than: How to fix Package inputenc Error: "Unicode char \u8:� not set up for use with LaTeX."?

I'm using TexLive and Texmaker with the elsarticle.cls document class. Bibtex is being used for the references as required by the document class. Because several of the references are in Russian the following is in the preamble:

\usepackage[T1,T2A]{fontenc}% Russian language support
\usepackage[utf8]{inputenc}
%% `Elsevier LaTeX' style
\bibliographystyle{elsarticle-num}

Both the .tex file and the .bib files are in UTF8 encoding (using the command file -I (filename) in terminal on a mac). For some reason when the document is compiled the .bbl file is in unknown encoding. Attempting to declare the unicode characters

\DeclareUnicodeCharacter{2013}{\textendash}

has no effect on the error message being thrown:

! Package inputenc Error: Unicode char \u8:�. not set up for use with LaTeX.See the inputenc package documentation for explanation.Type H <return> for immediate help.... �.

The line numbers of the error match the lines of the .bbl file generated.

The other clues are that the errors do not happen until the document is compiled with pdflatex, bibtex, and then pdflatex. Further, if the .bib file with the Russian Cyrillic is commented out the error does not happen. The last clue from the terminal on my mac, file -I (filename) shows that the .bbl file is in utf8 when using another document that is in the report document class and uses:

\bibliographystyle{unsrt}

Does anyone have any suggestions on troubleshooting this or a potential fix?

To make an example for yourself, simply download the elsarticle template from here:

and add this to the bib file:

@book{aizenshtata_features_1952,
    address = {Ленинград},
    series = {Главное управление гидрометеорологической службы при Совете Министров СССР. Труды Ташкентской геофизической обсерватории Вып. 6 (7)},
    title = {Some features of the heat balance of the sandy desert (in {Russian}: Некоторые черты теплового баланса песчаной пустыни)},
    abstract = {На обл. только загл. серии, Библиогр.: с. 54-55 (36 назв.)},
    language = {rus},
    publisher = {Гидрометеоиздат},
    author = {Айзенштат, Борис Абрамович},
    collaborator = {Зуев, М. В.},
    year = {1952},
    note = {pgs 3-55},
    keywords = {Пустыни песчаные -- Тепловой баланс},
    file = {3122870.pdf:/Users/nkampy/Library/Application Support/Zotero/Profiles/f12p038d.default/zotero/storage/PRG79WIE/3122870.pdf:application/pdf}
}

@book{kondratyev_transfer_1950,
    address = {Москва; Ленинград},
    title = {Transfer of long-wave radiation in the atmosphere (in Russian: Перенос длинноволнового излучения в атмосфере)},
    abstract = {Библиогр.: с. 285-287 (71 назв.)},
    language = {rus},
    publisher = {Госизд-во техн-теоретлит},
    author = {Кондратьев, Кирилл Яковлевич},
    year = {1950},
    keywords = {Атмосфера -- Лучистый теплообмен -- Определение, Тепловое излучение, длинноволновое -- Перенос и поглощение в атмосфере}
}

@inproceedings{gordov__calculation_1938,
    address = {Ленинград},
    title = {Calculation of direct solar radiation on inclined surfaces differently oriented on the latitude 42{\degree} (in {R}ussian: Расчет прямой солнечной радиации на различно ориентированные наклонные поверхности для широты 42{\degree})},
    booktitle = {Материалы по агроклиматическому районированию субтропиков СССР},
    publisher = {Гидрометеорологическое изд-во},
    author = {{Гордов А.Н.}},
    year = {1938},
    file = {ER16-04761.pdf:/Users/nkampy/Library/Application Support/Zotero/Profiles/f12p038d.default/zotero/storage/TUTQK3QF/ER16-04761.pdf:application/pdf}
}

And add this to the .tex file:

%%%%%% Packages Added By Author %%%%%%
\usepackage[T1,T2A]{fontenc}% Russian language support
\usepackage[utf8]{inputenc}
%\DeclareUnicodeCharacter{2013}{\textendash}
%\DeclareUnicodeCharacter{00A0}{ }
%\DeclareUnicodeCharacter{00A0}{~}
\usepackage[russian,USenglish]{babel}

\usepackage{gensymb}% \degree command

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

and this in the main body after the template citations:

Test references: \cite{aizenshtata_features_1952, kondratyev_transfer_1950, gordov__calculation_1938}

You can see for yourself that the problem is with how the elsarticle article class handles conversion of Cyrillic letters in the names to initials for the bibliography. You can also see that unicode characters are being handled correctly otherwise.

enter image description here

Best Answer

The form of the error message shows you have an old version of latex, newer versions give the number. As posted here that question mark is U+fffd (replacement character) but that is usually substituted (perhaps by this site) when there is an encoding error in the file. You could use

\DeclareUnicodeCharacter{FFFD}{????}

which, if it is U+FFFD in your file, will make the error go and looking for ???? in your output will show where the problem is.

Related Question