#734 unicode/encoding support for console mode gnuplot on Windows
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]:
ConsoleReadChinternally handles Unicode input and translates it to the currently setencoding.- 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
ConsolePutSandConsolePutCh, which handle encodings and use the WCHAR Console API variant.ConsolePutChshares a large fraction of the code with wgnuplot's equivalentTextPutCh.
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.
Screenshots with mintty/bash/winpty and cmd consoles.
In CVS now. If necessary, handling of double-wide characters can be fixed later. Chances are likely 50:50 that I got it right...
No feedback so far - so I may have gotten it right... Closing.