Gnuplot 设置编码 utf8 不起作用

use*_*712 4 encode gnuplot utf-8

我在 Windows 8 上有 gnuplot(版本 4.6 patchlevel 5)。我想设置 encofing utf8。我以 UTF8 编码保存源代码。我的源test.txt:

\n\n
set terminal pdf enhanced size 16cm,8cm font ", 10"\nset output "Slozitost/Slozitost.pdf"\nset encoding utf8\nset grid\nset datafile separator ","\nset title "Slo\xc5\xbeitost" font ",10"\nset key left top title "Legenda" box\nset xdata time \nset timefmt "%d/%m/%Y"\nset xrange ["03/01/2009":"20/04/2014"]\nset format y "%10.0f"\n#set yrange [-50:14000000]\nset format x "%m/%y"\nset xtics 6*30*24*60*60\n#set ytics 100\nset lmargin  13\nset rmargin  2\nset style fill transparent solid 0.5 noborder\nplot \'Slozitost.csv\' using 1:2 title "Slozitost" with lines linecolor rgb "blue" lw 3\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试通过 gnuplot 终端编译源代码。Gnuplot 终端对我说这个错误:

\n\n
gnuplot> load "test.txt"\n          ^\n         "test.txt", line 1: invalid character \xc2\xbb\n
Run Code Online (Sandbox Code Playgroud)\n\n

怎么了??

\n

Chr*_*oph 5

我认为如果您的文件开头有 BOM 标记,就会发生这种情况。Gnuplot 无法处理这个问题。要删除它,请参阅编辑器的文档。

\n\n

如果这是错误的根源,则将代码复制并粘贴到交互式终端中应该可以正常工作。

\n\n

顺便说一句:没有必要发布这么大的脚本,我们无法运行(我们没有数据文件)。可以显示问题的最小脚本类似于

\n\n
set encoding utf8\nplot x title "Slo\xc5\xbeitost"\n
Run Code Online (Sandbox Code Playgroud)\n\n

这也会缩小问题的根源:)

\n