In git version, some demos are inseted the followin codes:
save_encoding = GPVAL_ENCODING
set encoding utf8
...
reset
set encoding save_encoding
However, it may make error (git version at 2021-01-26 on FreeBSD):
cd demo
../src/gnuplot complex_airy.dem
set encoding save_encoding
^
"complex_airy.dem" line 74: unrecognized encoding specification; see 'help encoding'.
By printf debugging, I see that on the following line of src/set.c (set_encoding()):
/* allow string variables as parameter */
if ((temp == S_ENC_INVALID) && isstringvalue(c_token) && (senc = try_to_get_string())) {
isstringvalue(c_token) seems to be 0 because the udv_value.type == NOTDEFINED, so the try_to_get_string() will not be done. I don't know why the type is NOTDEFINED.
This is weird. Unfortunately, I cannot reproduce this on Windows.
The mechanism in the demos is not new by the way. I just added it to some more of the newer demos. It only matters if the default encoding on your platform is different from utf8, like e.g. on Windows. After you start gnuplot, what is the result of the following commands?
(Just to be sure: can you also try a "make clean" and rebuild?)
It has broken for me also. The "save encoding at start and restore at end" strategy doesn't work when there is a "reset session" command in between. On the other hand, the
reset sessionitself restores the original encoding, so I think the save/set/restore sequence isn't needed anyhow.I have reverted the change to the demo for now because it breaks my automated testing sequence.
Thanks. I understand. For example,
works correctly, but,
makes a error:
"reset session" may break variables.