Menu

#734 unicode/encoding support for console mode gnuplot on Windows

Version 6
closed-accepted
5
2025-07-21
2016-07-31
No

This patchset implements Unicode/encoding support for console mode gnuplot. It works very similar to the patches for wgnuplot [#727]:

  • ConsoleReadCh internally handles Unicode input and translates it to the currently set encoding.
  • Modfied versions of the wgnuplot input/output functions in winmain.c/wtext.h intercept calls to the stdio functions and pass all screen output to
  • two new functions ConsolePutS and ConsolePutCh, which handle encodings and use the WCHAR Console API variant. ConsolePutCh shares a large fraction of the code with wgnuplot's equivalent TextPutCh.
    Since all input/output is now done via the Unicode API, we can also remove all (other) code which changes the console's codepage or changes string encodings.
command.c     |   61 -----------
plot.c        |   27 -----
readline.c    |   10 +
syscfg.h      |    2
win/winmain.c |  307 +++++++++++++++++++++++++++++++++++++++++-----------------
win/winmain.h |    1
win/wtext.c   |   72 -------------
win/wtext.h   |   27 ++---
8 files changed, 251 insertions(+), 256 deletions(-)

Double wide characters (i.e. Japanese) currently do not display at all on my system when using cmd.exe as the shell, allthough the input works just fine. That might have to do with local fonts. Hence, I also cannot test if overwriting / erasing those characters in readline.c would require one or two space/backspace characters. You can switch that behaviour by defining WGP_CONSOLE_DOUBLE_WIDTH during compilation.

1 Attachments

Related

Patches: #727

Discussion

  • Bastian Märkisch

    Screenshots with mintty/bash/winpty and cmd consoles.

     
  • Bastian Märkisch

    • status: open --> pending-accepted
     
  • Bastian Märkisch

    In CVS now. If necessary, handling of double-wide characters can be fixed later. Chances are likely 50:50 that I got it right...

     
  • Bastian Märkisch

    • status: pending-accepted --> closed-accepted
     
  • Bastian Märkisch

    No feedback so far - so I may have gotten it right... Closing.

     

Log in to post a comment.