[luatex] string.char

Heiko Oberdiek heiko.oberdiek at googlemail.com
Tue Apr 12 11:05:29 CEST 2011

On Tue, Apr 05, 2011 at 11:31:50AM +0200, Paul Isambert wrote:

> Le 05/04/2011 10:49, Taco Hoekwater a écrit :
> >On 04/04/2011 10:01 PM, Paul Isambert wrote:
> >>>\directlua{tex.settoks(0, "A\string\000B")}
> >>>has the wrong result "A^^@^^X", thus I conclude that
> >>>tex.settoks might be the problem.
> >>
> >>So it seems you've found yourself a nice bug to report :)
> >>I say so because I don't think Taco is reading the list much these
> >>times, so a tracker item would be safer.
> >
> >I actually do read the list, but usually have no time to reply these
> >days.
> >
> >In this case, the problem is indeed the settoks as that used
> >strdup() to get the needed memory (and therefore stops at the
> >first \000). There was a simple fix, so I have applied something
> >immediately. If you can, please try rev. 4096.
> It works very well: tested with tex.settoks(0, string.char(65, 0,
> 66) and tex.settoks(0, "A\string\000B"), both return "A^^@B".

Thanks Taco and Paul for fixing and testing.
In package pdftexcmds that emulates \pdfescape... for LuaTeX
I have now added a workaround for the problematic versions
(0.41?, ..., 0.65).
  The endpoint would be revision 4096, but status.luatex_svn
does not work always as expected:

    [#1: \directlua{tex.write(status.luatex_#1)}]%
\csname @@end\endcsname\end

Result for TL2010:
  [svn: 3736]
  [version: 60]
  [revision: 2]

Result for luatex 0.65.0 from ConTeXt minimals:
  [svn: -1]
  [version: 65]
  [revision: 0]

Yours sincerely
  Heiko Oberdiek

More information about the luatex mailing list