# Error when using endfloat with unicode characters

I have a problem with the endfloat package and unicode characters. When I compile the following, everything works as expected:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\caption{Ö}
\end{figure}

\end{document}


However, when I also load the endfloat package (\usepackage{endfloat}), I get the following error message:

! Package inputenc Error: Unicode char \u8:ÖÖ not set up for use with LaTeX.


This could be a bug, but my suspicion is that I'm making a mistake somewhere. I'm hardly the first person to use special characters with the endfloat package. However, the above example is so simple, I don't see where I could have made a mistake. Any advice is appreciated.

Edit: The file is of course encoded using utf-8.

• Looks like a bug more than a mistake. In absence of real solution, you can get out of trouble using \"O instead of Ö for captions. – Fran Nov 11 '13 at 13:44
• @Fran Yes, it's a bug. – egreg Nov 11 '13 at 15:40
• I just submitted a bug report to the maintainers of the package. – tmalsburg Nov 12 '13 at 10:55
• tmalsburg has submitted the bug to me and I have submitted it to the real maintainer of endfloat, offering that I'm willing to make the patch and publish the version to CTAN. (I have made releases of endfloat in the past with permission of the maintainer.) Unfortunately Jeff hasn't answered so far, so I just tried to contact him again. So please hold the line... – Axel Sommerfeldt Jun 11 '16 at 13:14
• This is finally fixed in endfloat v2.6 – Axel Sommerfeldt Mar 25 '18 at 8:46

I solved the same problem in the GuIT forum about nine months ago recommending to make a bug report: see Cambiare posizionamento immagini tutte alla fine del testo.

Where's the issue? The package endfloat uses \write for writing in its auxiliary files, whereas \protected@write should be used.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{endfloat}

% patch \efloat@iwrite to use \protected@write
\makeatletter
\renewcommand\efloat@iwrite[1]{%
\immediate\expandafter\protected@write\csname efloat@post#1\endcsname{}}
\makeatother

\begin{document}

\begin{figure}
\caption{Ö}
\end{figure}

\end{document}