Re: About tex.error (and logs.texerrormessage)
"Jairo A. del Rio" <[email protected]> Mon, 3 Aug 2026 03:42:48 -0500
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <CAKyqqaaS_yJsEELoCYPBUW_2DL2-1G+rTn0gfA4Weqv=9yVdww@mail.gmail.com> |
--===============0473796043213497322== Content-Type: multipart/alternative; boundary="000000000000f494b30658208637" --000000000000f494b30658208637 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable El lun, 3 ago 2026 a la(s) 3:02=E2=80=AFa.m., Hans Hagen via ntg-context ( [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 character= %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 there > are unicode characters printed they go via the utf serializer (that > iself then outputs per char). So, this test is kind of redundant but if > you somehow have > 255 integers going into it, the test indicates an > 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 > (The engine is - and always was - outputting unbuffered because > otherwise users can be puzzled by the lack of output while tex is > working hard on something, esp on machine 40 years ago. here we put a > lot of effort in making it as efficient as possible, given the > constraints. Also think of Lua beging in the game with output.) > > 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 > > _________________________________________________________________________= __________ > --000000000000f494b30658208637 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) 3:02=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 9:29 AM, Jairo A. = del Rio wrote:<br> > Hi, list! When one tries to print non-ASCII characters using <br> > logs.texerrormessage, based on tex.error, "weird character" = and a <br> > negative value is printed and characters are just ignored. This warnin= g <br> > comes from here in texprinting.c:<br> > <br> >=C2=A0 =C2=A0153 =E2=94=82 void tex_print_char(int s)<br> >=C2=A0 =C2=A0154 =E2=94=82 {<br> >=C2=A0 =C2=A0155 =E2=94=82 =C2=A0 =C2=A0 if (s < 0 || s > 255) {<= br> >=C2=A0 =C2=A0156 =E2=94=82 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tex_formatted_wa= rning("print", "weird character %i", s);<br> > <br> > I wonder whether a cast is needed here or it's rather a bug coming= from <br> > custom compiling flags as it is my case.<br> <br> Unless I did something wrong, this one should never be called with a <br> negative or > 255 integer as it eventually outputs one byte. If there <b= r> are unicode characters printed they go via the utf serializer (that <br> iself then outputs per char). So, this test is kind of redundant but if <br= > you somehow have > 255 integers going into it, the test indicates an <br= > error anyway. Fwiw, this logging is kind of complex as we have log file <br= > in parallel to terminal output and in other printing routines also pipe <br= >into strings.<br></blockquote><div><br></div><div>I removed the test and r= ecompiled both luametatex and ConTeXt. Now Unicode characters are printed n= ormally and everything else seems to work as I compile some documents</div>= <div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px = 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> (The engine is - and always was - outputting unbuffered because <br> otherwise users can be puzzled by the lack of output while tex is <br> working hard on something, esp on machine 40 years ago. here we put a <br> lot of effort in making it as efficient as possible, given the <br> constraints. Also think of Lua beging in the game with output.)<br> <br> 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> --000000000000f494b30658208637-- --===============0473796043213497322== 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 ___________________________________________________________________________________ --===============0473796043213497322==--