# incompatibilities between LuaLaTeX and \typein ?

The following ecm compiles fine with LaTeX and XeLaTeX, but doesn't work with LuaLaTeX :

\documentclass{minimal}
\begin{document}
\typein{test}
\end{document}


And here is the error :

Invalid \endlinechar.

l.4 \typein{test}

?

-
\endlinechar seems to get set to \@M which is 10000, a value normally used as maximum for penalties. The TeXBook states that for values <0 and >255 no endline character is appended to the line. Maybe in LuaTeX the value for \endlinechar is limited to some value below 10000 and therefore this causes an error? –  Martin Scharrer Mar 1 '11 at 21:34
The manual of luatex says in the section about modifications: "The upper limit to \endlinechar and \newlinechar is 127.". So it won't work. –  Ulrike Fischer Mar 2 '11 at 8:47
\endlinechar=-1 should work for the intended purpose. Note that even if luatex were to accept \endlinechar=10000, this would mean something completely different: in unicode, char 10000 is actually "UPPER RIGHT PENCIL" –  Taco Hoekwater Mar 2 '11 at 11:30
@Taco, could you post an answer with the exact code (where should I write \endlinechar=-1 ?), please ? –  Matsaya Mar 2 '11 at 16:20
I assume you will have to redefine \typein, but I assume this should be a job for the lualatex format itself. In any case, you will have to ask a latex expert, which I am definitely not... –  Taco Hoekwater Mar 2 '11 at 18:25

You probably have to patch the kernel (untested):

\def\@xtypein[#1]#2{%
\typeout{#2}%
\@tempcnta\endlinechar
\endlinechar\m@ne