Allin Cottrell
2017-03-24 00:09:14 UTC
Sorry, this is quite ticklish but I'll try to explain it as best I
can.
I'm not sure, from reading the gnuplot help on "encoding", of the
exact scope and effect of giving a "set encoding XXX" command in a
plot file.
Here's the context: my program writes a gnuplot command file,
designed to produce PNG output via the pngcairo "terminal", and
among the users of the program are people working on Windows in
Russian. There are two possible non-ASCII elements in the plot file:
1) the name of the output file (as in "set output 'OOO'"), which for
MS Windows in Russian will be encoded in CP1251; and
2) strings occurring in titles, labels or whatever in the body of
the plot: by default these will be in UTF-8, which is what pngcairo
expects.
At present I'm sticking a line into the plot file:
set encoding utf8
which I hope is going to tell gnuplot, "Whatever you might think
based on the fact that you're working on Windows in Russian, please
interpret titles/labels as being in UTF-8."
So here's the question: given that the output filename is in CP1251,
is my "set encoding" line liable to interfere with gnuplot's output
routine (for example, such that output cannot be written because
some non-ASCII component of the path is non-existent, if the bytes
are interpreted as UTF-8), or is gnuplot's I/O mechanism separate
and insulated from "set encoding"?
As you might expect, this is not merely hypothetical: I'm getting an
error report from a Russian Windows user, and I wonder if the fact
that wgnuplot.exe is exiting with a non-zero code when trying to
process a command file written by my program might have something to
do with a text encoding issue.
can.
I'm not sure, from reading the gnuplot help on "encoding", of the
exact scope and effect of giving a "set encoding XXX" command in a
plot file.
Here's the context: my program writes a gnuplot command file,
designed to produce PNG output via the pngcairo "terminal", and
among the users of the program are people working on Windows in
Russian. There are two possible non-ASCII elements in the plot file:
1) the name of the output file (as in "set output 'OOO'"), which for
MS Windows in Russian will be encoded in CP1251; and
2) strings occurring in titles, labels or whatever in the body of
the plot: by default these will be in UTF-8, which is what pngcairo
expects.
At present I'm sticking a line into the plot file:
set encoding utf8
which I hope is going to tell gnuplot, "Whatever you might think
based on the fact that you're working on Windows in Russian, please
interpret titles/labels as being in UTF-8."
So here's the question: given that the output filename is in CP1251,
is my "set encoding" line liable to interfere with gnuplot's output
routine (for example, such that output cannot be written because
some non-ASCII component of the path is non-existent, if the bytes
are interpreted as UTF-8), or is gnuplot's I/O mechanism separate
and insulated from "set encoding"?
As you might expect, this is not merely hypothetical: I'm getting an
error report from a Russian Windows user, and I wonder if the fact
that wgnuplot.exe is exiting with a non-zero code when trying to
process a command file written by my program might have something to
do with a text encoding issue.
--
Allin Cottrell
Department of Economics
Wake Forest University
Allin Cottrell
Department of Economics
Wake Forest University