|
From: Ethan M. <merritt@u.washington.edu> - 2006-10-16 16:43:28
|
On Sunday 15 October 2006 11:10 pm, Petr Mikulik wrote:
>
> I've just tried after your latest patch, it works with UTF-8 and 'set
> enco default', but not for latin2. Try this:
>
> Write b.gp in UTF-8:
>
> set encoding iso_8859_2
> set term svg
> set out 'b.svg'
> set title "P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=
=88 =C3=BAp=C4=9Bl =C4=8F=C3=A1belsk=C3=A9 =C3=B3dy."
> set xlabel "P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=
=C5=88 =C3=BAp=C4=9Bl =C4=8F=C3=A1belsk=C3=A9 =C3=B3dy."
> set ylabel "P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=
=C5=88 =C3=BAp=C4=9Bl =C4=8F=C3=A1belsk=C3=A9 =C3=B3dy."
> plot x
>
> recode utf8..latin2 b.gp
> gnuplot b.gp
>
>
> =3D> the file is rendered incorrectly; the text appears as:
>
> <text>Pøíli¹ ¾lu»ouèký
> kùò úpìl ïábelské ódy.</text>
But that is what it was doing already, *before* my utf-8 patch.
The change to write non-ascii characters in the form »
was due to this patch:
2006-10-03 Hans-Bernhard Broeker <br...@ph...>
* term/svg.trm: Change sprintf() and fprintf() to strcpy and
fputs, all over the place.
(SVG_put_text): Fix handling of XML reserved characters in
non-enhanced text output.
That patch broke things for me, also, which is what started me
on the path to reworking the code so that at least it works in
my utf-8 environment.
So I think we have a problem here.
Apparently Hans-Bernhard's svg viewer does not like the inline
non-ascii characters, whereas your viewers and mine require them
in order to process the encoding correctly.
The minimal reversion to pre-Oct 3 behavior is
=2D-- gnuplot/term/svg.trm 2006-10-12 10:53:40.000000000 -0700
+++ gnuplot-cvs/term/svg.trm 2006-10-16 09:37:36.000000000 -0700
@@ -945,10 +945,12 @@
fputs("&", gpoutfile);
break;
default:
+#if (0)
/* Some SVG viewers really dislike non-ascii characters */
if (symb < ' ' || symb > '~')
fprintf(gpoutfile, "&#x%2.2x;", symb);
else
+#endif
fputc(*str, gpoutfile);
break;
}
That only changes the non-enhanced mode output, however.
If you need to change the enhanced mode output also, then add
@@ -1222,12 +1224,14 @@
/* Kludge for phantom box accounting */
ENHsvg_charcount++;
=20
+#if (0)
/* My SVG viewers really dislike non-ascii characters */
if (symb < ' ' || symb > '~') {
sprintf(enhanced_cur_text, "&#x%2.2x;", symb);
enhanced_cur_text +=3D 6;
return;
}
+#endif
=20
/* Escape SVG reserved characters. Are there any besides '<' and=20
'&' ? */
switch (c) {
=2D-=20
Ethan A Merritt
Biomolecular Structure Center
University of Washington, Seattle WA
|