|
From: Allin C. <cot...@wf...> - 2020-12-04 13:57:57
|
On Thu, 3 Dec 2020, Bastian Märkisch wrote:
> Dear Allin,
>
> sorry for being slow to work on this. There is a fundamental issue with
> the approach, which I am working on how to resolve best. Translating all
> the command line arguments to UTF-8 is a great step forward and the
> loading of files works fine as you point out. But this change also
> affects and potentially breaks the -e option (try e.g.
> -d -e "print 'öäü'").
OK, I take your point: any non-ASCII stuff in a "-e" clause on the
command line is going to get mangled.
> The best step in my opinion might be to just change gnuplot's default
> encoding to utf8. This will break backward compatibility, though. A
> remedy could be new command line options -a/-u which choose the system's
> default encoding ("ANSI") or the utf8 encoding.
I have one other thought, and I'll try experimenting. Besides
setting argv to the UTF-8 recoded argument array in winmain.c, we
could define (say) aargv to the "ANSI" version:
#define aargv __argv
then when iterating over the args in the test for interactivity
(around line 630 in winmain.c) add a clause such as:
if ((argv[i][0] == '-') && (argv[i][1] == 'e')) {
if (i < argc - 1) {
argv[i+1] = aargv[i+1];
}
}
This would (I think) replace the UTF-8 follow-up to -e with the
original locale version, for passing to gnumain().
> Please find attached a simplified version of your patch, which also
> works for console mode gnuplot and other compilers than MinGW.
Thanks.
Allin Cottrell |