From: Bastian M. <bma...@we...> - 2020-12-22 16:33:53
|
Another somewhat simplified variant of the code is now in the master branch. It's been tested with MSVC, MinGW-w64, and OpenWatcom for console gnuplot and wgnuplot. We still translate the complete command line to UTF-8. I now think this is a desirable step, which enables using Unicode also for -e commands. As a next step, we should probably change the default encoding to UTF-8. This backwards-incompatible change should have been made with 5.4 already. Bastian > Gesendet: Freitag, 04. Dezember 2020 um 14:04 Uhr > Von: "Allin Cottrell" <cot...@wf...> > An: "Bastian Märkisch" <bma...@we...> > Cc: "gnuplot-beta" <gnu...@li...> > Betreff: Re: Aw: filenames on MS Windows: follow-up > > 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 |