Re: About tex.error (and logs.texerrormessage)

"Jairo A. del Rio" <[email protected]> Mon, 3 Aug 2026 13:33:55 -0500
Newsgroups gmane.comp.tex.context
Message-ID <CAKyqqaZHiYA-eXr6P4HRe4ZWdum02e1OsaGKyfau-3hrMwORxg@mail.gmail.com>
--===============6987727685500491052==
Content-Type: multipart/alternative; boundary="000000000000dee859065828c847"

--000000000000dee859065828c847
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

El lun, 3 ago 2026 a la(s) 5:42=E2=80=AFa.m., Hans Hagen via ntg-context (
[email protected]) escribi=C3=B3:

> On 8/3/2026 10:42 AM, Jairo A. del Rio wrote:
> >
> >
> > El lun, 3 ago 2026 a la(s) 3:02=E2=80=AFa.m., Hans Hagen via ntg-contex=
t (ntg-
> > [email protected] <mailto:[email protected]>) escribi=C3=B3:
> >
> >     On 8/3/2026 9:29 AM, Jairo A. del Rio wrote:
> >      > Hi, list! When one tries to print non-ASCII characters using
> >      > logs.texerrormessage, based on tex.error, "weird character" and =
a
> >      > negative value is printed and characters are just ignored. This
> >     warning
> >      > comes from here in texprinting.c:
> >      >
> >      >   153 =E2=94=82 void tex_print_char(int s)
> >      >   154 =E2=94=82 {
> >      >   155 =E2=94=82     if (s < 0 || s > 255) {
> >      >   156 =E2=94=82         tex_formatted_warning("print", "weird ch=
aracter
> >     %i", s);
> >      >
> >      > I wonder whether a cast is needed here or it's rather a bug
> >     coming from
> >      > custom compiling flags as it is my case.
> >
> >     Unless I did something wrong, this one should never be called with =
a
> >     negative or > 255 integer as it eventually outputs one byte. If the=
re
> >     are unicode characters printed they go via the utf serializer (that
> >     iself then outputs per char). So, this test is kind of redundant bu=
t
> if
> >     you somehow have > 255 integers going into it, the test indicates a=
n
> >     error anyway. Fwiw, this logging is kind of complex as we have log
> file
> >     in parallel to terminal output and in other printing routines also
> pipe
> >     into strings.
> >
> >
> > I removed the test and recompiled both luametatex and ConTeXt. Now
> > Unicode characters are printed normally and everything else seems to
> > work as I compile some documents
>
> well, it means that you let c print an invalid character so i guess it
> will crash at some point
>
> what was your test case as it might was wel be some other issue there
>

Just this:

\starttext

\startluacode
% logs.texerrormessage doesn't make any difference
tex.error"Cig=C3=BCe=C3=B1a"
\stopluacode

\stoptext

and I get this

luatex warning  > print: weird character -61
luatex warning  > print: weird character -68
luatex warning  > print: weird character -61
luatex warning  > print: weird character -79
tex error       > tex error on line 5 in file ./test.tex: Cigea

I thought it might have been something about my custom build, but I've
tested stock luametatex and I have similar results on Linux.

Hans
>
> -----------------------------------------------------------------
>                                            Hans Hagen | PRAGMA ADE
>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>
> _________________________________________________________________________=
__________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : [email protected] /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror=
)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
>
> _________________________________________________________________________=
__________
>

--000000000000dee859065828c847
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g=
mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">El lun, 3 ago 2=
026 a la(s) 5:42=E2=80=AFa.m., Hans Hagen via ntg-context (<a href=3D"mailt=
o:[email protected]">[email protected]</a>) escribi=C3=B3:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">On 8/3/2026 10:42 AM, Jairo A.=
 del Rio wrote:<br>
&gt; <br>
&gt; <br>
&gt; El lun, 3 ago 2026 a la(s) 3:02=E2=80=AFa.m., Hans Hagen via ntg-conte=
xt (ntg- <br>
&gt; <a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>=
 &lt;mailto:<a href=3D"mailto:[email protected]" target=3D"_blank">ntg-con=
[email protected]</a>&gt;) escribi=C3=B3:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 8/3/2026 9:29 AM, Jairo A. del Rio wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Hi, list! When one tries to print non-ASCII c=
haracters using<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; logs.texerrormessage, based on tex.error, &qu=
ot;weird character&quot; and a<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; negative value is printed and characters are =
just ignored. This<br>
&gt;=C2=A0 =C2=A0 =C2=A0warning<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; comes from here in texprinting.c:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0153 =E2=94=82 void tex_print_char=
(int s)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0154 =E2=94=82 {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0155 =E2=94=82 =C2=A0 =C2=A0 if (s=
 &lt; 0 || s &gt; 255) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0156 =E2=94=82 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 tex_formatted_warning(&quot;print&quot;, &quot;weird character<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0%i&quot;, s);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; I wonder whether a cast is needed here or it&=
#39;s rather a bug<br>
&gt;=C2=A0 =C2=A0 =C2=A0coming from<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; custom compiling flags as it is my case.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Unless I did something wrong, this one should never=
 be called with a<br>
&gt;=C2=A0 =C2=A0 =C2=A0negative or &gt; 255 integer as it eventually outpu=
ts one byte. If there<br>
&gt;=C2=A0 =C2=A0 =C2=A0are unicode characters printed they go via the utf =
serializer (that<br>
&gt;=C2=A0 =C2=A0 =C2=A0iself then outputs per char). So, this test is kind=
 of redundant but if<br>
&gt;=C2=A0 =C2=A0 =C2=A0you somehow have &gt; 255 integers going into it, t=
he test indicates an<br>
&gt;=C2=A0 =C2=A0 =C2=A0error anyway. Fwiw, this logging is kind of complex=
 as we have log file<br>
&gt;=C2=A0 =C2=A0 =C2=A0in parallel to terminal output and in other printin=
g routines also pipe<br>
&gt;=C2=A0 =C2=A0 =C2=A0into strings.<br>
&gt; <br>
&gt; <br>
&gt; I removed the test and recompiled both luametatex and ConTeXt. Now <br=
>
&gt; Unicode characters are printed normally and everything else seems to <=
br>
&gt; work as I compile some documents<br>
<br>
well, it means that you let c print an invalid character so i guess it <br>
will crash at some point<br>
<br>
what was your test case as it might was wel be some other issue there<br></=
blockquote><div><br></div><div>Just this:<br><br>\starttext<br><br>\startlu=
acode<br></div><div>% logs.texerrormessage doesn&#39;t make any difference<=
/div><div>tex.error&quot;Cig=C3=BCe=C3=B1a&quot;<br>\stopluacode<br><br>\st=
optext<br><br></div><div>and I get this</div><div><br>luatex warning =C2=A0=
&gt; print: weird character -61<br>luatex warning =C2=A0&gt; print: weird c=
haracter -68<br>luatex warning =C2=A0&gt; print: weird character -61<br>lua=
tex warning =C2=A0&gt; print: weird character -79<br>tex error =C2=A0 =C2=
=A0 =C2=A0 &gt; tex error on line 5 in file ./test.tex: Cigea</div><div><br=
></div><div>I thought it might have been something about my custom build, b=
ut I&#39;ve tested stock luametatex and I have similar results on Linux.=C2=
=A0<br></div><div><br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x">
Hans<br>
<br>
-----------------------------------------------------------------<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0Hans Hagen | PRAGMA ADE<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80=
61 GH Hasselt | The Netherlands<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | <a href=3D"http://www.prag=
ma-ade.nl" rel=3D"noreferrer" target=3D"_blank">www.pragma-ade.nl</a> | <a =
href=3D"http://www.pragma-pod.nl" rel=3D"noreferrer" target=3D"_blank">www.=
pragma-pod.nl</a><br>
-----------------------------------------------------------------<br>
___________________________________________________________________________=
________<br>
If your question is of interest to others as well, please add an entry to t=
he Wiki!<br>
<br>
maillist : <a href=3D"mailto:[email protected]" target=3D"_blank">ntg-cont=
[email protected]</a> / <a href=3D"https://mailman.ntg.nl/mailman3/lists/ntg-conte=
xt.ntg.nl" rel=3D"noreferrer" target=3D"_blank">https://mailman.ntg.nl/mail=
man3/lists/ntg-context.ntg.nl</a><br>
webpage=C2=A0 : <a href=3D"https://www.pragma-ade.nl" rel=3D"noreferrer" ta=
rget=3D"_blank">https://www.pragma-ade.nl</a> / <a href=3D"https://context.=
aanhet.net" rel=3D"noreferrer" target=3D"_blank">https://context.aanhet.net=
</a> (mirror)<br>
archive=C2=A0 : <a href=3D"https://github.com/contextgarden/context" rel=3D=
"noreferrer" target=3D"_blank">https://github.com/contextgarden/context</a>=
<br>
wiki=C2=A0 =C2=A0 =C2=A0: <a href=3D"https://wiki.contextgarden.net" rel=3D=
"noreferrer" target=3D"_blank">https://wiki.contextgarden.net</a><br>
___________________________________________________________________________=
________<br>
</blockquote></div></div>

--000000000000dee859065828c847--

--===============6987727685500491052==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

--===============6987727685500491052==--