# LuaLaTeX and algorithm2e [closed]

The algorithm2e package seems to be not compatible with LuaLaTeX. For example, compiling the following code produces an error.

\documentclass{article}

\usepackage{fontspec}
\usepackage{algorithm2e}

\begin{document}
foo
\end{document}


Output of lualatex:

...
! String contains an invalid utf-8 sequence.
l.778 \renewcommand{\@algocf@procname}{Proc
�dure}%
?
! Emergency stop.


Has someone an idea how to fix that? I have a lot of algorithms typeset and do not want to switch to another package just because of LuaLaTeX.

-

## closed as off-topic by Werner, Kurt, Paul Gaborit, Papiro, JesseNov 25 '15 at 1:37

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

The Package is not in UTF-8 format. If you open it and save it back in UTF-8 format it works (for me). To try, please copy algorithm2e.sty in the same directory, open it with an editor that can save it back in UTF-8. – Andy Nov 14 '11 at 15:56
@Andy. That works too. Thanks for your tip! – Peter Nov 14 '11 at 16:38
@Andy: converting to utf8 will help with lualatex but then you will probably get wrong fix names with pdflatex + an 8bit-option of inputenc. Using non-ascii chars in a sty is simply a bad idea. – Ulrike Fischer Nov 14 '11 at 17:33
My version use procédure which is ok for french. A sty should be pure ascii and it doesn't matter how you save it as the result will be the same. ascii chars are encoded identically in utf8, ansinew, latin1 etc. – Ulrike Fischer Nov 14 '11 at 18:06
I'm voting to close this question as off-topic because this problem cannot be reproduced anymore. – Werner Nov 25 '15 at 1:03

algorithm2e.sty contains (at least) two non-ascii chars (é in procédure), but the file is 8bit encoded so it is not a valid utf8 file. You (or the author) should replace the é by \'e.
@Peter: Unfortunately there are several other usages of é in that file, so I would try to use search-and-replace. Please don't forget to post a email to the author and mentioning this. It should be fixed for the next release. – Martin Scharrer Nov 14 '11 at 16:03