I just noticed something weird. Take the following example
\documentclass{article}
\usepackage{hyperref}
\hypersetup{hidelinks}
\begin{document}
\tableofcontents
\addcontentsline{toc}{section}{``xxx''}
\addcontentsline{toc}{section}{Here---and \emph{there}}
\addcontentsline{toc}{section}{1--2 vs. 1-{}-2}
\addcontentsline{toc}{section}{\LaTeX}
\end{document}
which results in the following PDF
The printed contents is perfect, of course. The PDF bookmarks (on the left) are actually almost correct, too: various LaTeX specifics get converted into something meaningful (formatting commands get removed, \LaTeX becomes LaTeX, double and triple hyphens correctly become en- and em-dashes, etc.). I was surprised at first when I developed this example because I had just noticed the opening and closing double quotes which are left verbatim as pairs of single (back-)quotes, and thus I thought all these examples would be wrong. But no, only the double quotes are an example where the LaTeX input is not converted into the typographically correct PDF bookmark—or, at least, the only one among those which I thought of testing....
Is there anything to be done about this? I have thought of cloning the hyperref.sty definition of \addcontentsline and using \StrSubstitute from xstring to replace pairs of single quotes with double quotes when \Hy@writebookmark is used, but it looks a pretty clumsy and fragile solution. Any better idea?


\texorpdfstring, but it turns out to be unnecessary: rather than saying\texorpdfstring{``}{“}(which works) it is easier to forget about the LaTeX representation of opening quotes and write“directly. – Paolo Apr 11 '21 at 09:46---would be correctly substituted and''not as both are standard LaTeX (and, if you allow me, whether people notice or not is not really the point). – Paolo Apr 11 '21 at 09:52<<? Orfi? Such substituations slows down the compilation--even if there are no quotes hyperref would still have to look for all of them. Obviously who ever added them in the first place choose to do only the really visible ones and personally I think that is fine. – Ulrike Fischer Apr 11 '21 at 09:58