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 │ void tex_print_char(int s)
  154 │ {
  155 │     if (s < 0 || s > 255) {
  156 │         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.

(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
___________________________________________________________________________________

Reply via email to