gnuplot encoding utf8

545 views
Skip to first unread message

tech na

unread,
Dec 29, 2016, 12:19:42 AM12/29/16
to pywws
Hi Jim!
I updated pywws to 16.12.1 and to gnuplot
G N U P L O T Version 5.0 patchlevel 3 last modified 2016-02-21.
In weather.ini indicated encoding
template encoding = utf-8
language = ru
gnuplot version = 5
gnuplot encoding = utf8

A simple example #gnuplot test.txt:

# script start ==============================
set encoding utf8
set title "Hello, world! Привет, мир! Γεια σας κόσμο!"
set terminal pdf enhanced
set output "test.pdf"
plot sin(x)
set terminal postscript eps enhanced
set output "test.eps"
plot sin(x)
set terminal png
set output "test.png"
plot sin(x)
# script end ==============================

It displays the title in the correct encoding.

pywws displays in the wrong encoding.
template: <xml version = "1.0" encoding = "UTF-8"?>
#file tweet.png.xml: XML 1.0 document, UTF-8 Unicode text

How to get the right output encoding?
Thank you.

Jim Easterbrook

unread,
Dec 29, 2016, 11:42:11 AM12/29/16
to py...@googlegroups.com
On 29/12/16 05:19, tech na wrote:
> In weather.ini indicated encoding
> template encoding = utf-8
> language = ru
> gnuplot version = 5
> gnuplot encoding = utf8

That all looks OK.

> pywws displays in the wrong encoding.

I assume you mean the png file has the wrong encoding.

> template: <xml version = "1.0" encoding = "UTF-8"?>
> #file tweet.png.xml: XML 1.0 document, UTF-8 Unicode text
>
> How to get the right output encoding?

I don't know, you appear to have done all the right things. Can you send
me your tweet.png.xml file that has the problem?
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

tech na

unread,
Dec 29, 2016, 9:05:19 PM12/29/16
to pywws
Of course. Thank you.

четверг, 29 декабря 2016 г., 19:42:11 UTC+3 пользователь Jim Easterbrook написал:
tweet.png.xml.tar.gz

tech na

unread,
Jan 9, 2017, 4:01:07 AM1/9/17
to pywws
Up.


четверг, 29 декабря 2016 г., 19:42:11 UTC+3 пользователь Jim Easterbrook написал:
On 29/12/16 05:19, tech na wrote:

Jim Easterbrook

unread,
Jan 9, 2017, 4:50:33 AM1/9/17
to py...@googlegroups.com
On 09/01/17 09:01, tech na wrote:
> Up.

My apologies. With Christmas and new year I'd completely forgotten to
look at this.

I've just tried your template and I'm getting a mangled title, so at
least I can reproduce your problem. I'll investigate further.

tech na

unread,
Jan 9, 2017, 5:38:08 AM1/9/17
to pywws
I understand.
By the way Jim, Happy New Year and Merry Christmas!

понедельник, 9 января 2017 г., 12:50:33 UTC+3 пользователь Jim Easterbrook написал:

Jim Easterbrook

unread,
Jan 9, 2017, 5:38:12 AM1/9/17
to py...@googlegroups.com
On 09/01/17 09:50, Jim Easterbrook wrote:
>
> I've just tried your template and I'm getting a mangled title, so at
> least I can reproduce your problem. I'll investigate further.

By commenting out lines 740 & 741 in Plot.py I can inspect the temporary
files used to create the plot. The command file is utf8 text and shows
that the correct encoded strings are being passed to gnuplot, so it
appears to be a bug in gnuplot.

According to http://www.gnuplotting.org/output-terminals/ "It exists
also a png terminal, but it produces uglier output and doesn’t use the
UTF-8 encoding the cairo library does."

I used ISO-8859-1 encoding in the pywws example templates and hadn't
realised that gnuplot's png terminal doesn't accept utf8. There are some
examples that use the 'pngcairo' terminal, including a tweet template.
https://github.com/jim-easterbrook/pywws/blob/master/src/pywws/examples/graph_templates/pngcairo/tweet.png.xml

The 'pngcairo' terminal produces much better looking output than 'png',
so it's worth using if your gnuplot installation has it. The main
difference in the templates is that the <terminal> line is replaced by
<fileformat> and <size> lines.

tech na

unread,
Jan 9, 2017, 9:54:44 AM1/9/17
to pywws
I checked it works.
Thank you.

понедельник, 9 января 2017 г., 13:38:12 UTC+3 пользователь Jim Easterbrook написал:
Reply all
Reply to author
Forward
0 new messages