[luatex] string.char

Paul Isambert zappathustra at free.fr
Mon Apr 4 22:01:21 CEST 2011


Le 04/04/2011 20:33, Heiko Oberdiek a écrit :
> On Mon, Apr 04, 2011 at 06:32:58PM +0200, Paul Isambert wrote:
>
>> Le 04/04/2011 18:14, Heiko Oberdiek a écrit :
>>> Hello,
>>>
>>> I have some obscure problem with string.char:
>>>
>>> % luatex -ini
>>> \catcode`\{=1
>>> \catcode`\}=2
>>> \newlinechar=-1
>>>
>>> \directlua{tex.settoks(0, string.char(65, 0, 66))}
>>> \message{\the\toks0}
>>>
>>> \csname @@end\endcsname\end
>>>
>>>
>>> As result I expect "A^^@B", but I get "A^^@^^@".
>>> All bytes after the first zero are ^^@ (zero byte).
>>>
>>> Tested with luatex 0.60.2 and 0.65.0.
>> No answer, but an additional observation: LuaTeX 0.66 (rev. 4087)
>> with your code complains about an invalid UTF-8 sequence and then
>> prints "A^^@" followed by some gibberish. But if I simply add
>> another 65 before the 0, then it doesn't complain, but prints
>> AA^^@^^@. That smells like bug.
> Further addition:
>    \message{\directlua{tex.print(string.char(65, 0, 66))}}
> works, but
>    \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.

Best,
Paul


More information about the luatex mailing list