Subject: | UTF-8 characters makes GraphViz chop off the end of the dot-file |
If there are labels with utf-8 characters in them, GraphViz cuts off the
end of the dot-file, making the resulting graphs incomplete.
Here is a small example:
== =
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use GraphViz;
my $graph=GraphViz->new;
$graph->add_node('one', label=>'ΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔΔ');
$graph->add_node('two', label=>'123456789abcdefghijklmno');
open my $fh, '>', 'out.png' or die $!;
print $fh $graph->as_png;
== =
This script generates an out.png file with a node labelled with deltas
and another node with the label "123456" instead of the expected
"123456789abcdefghijklmno"; when run, dot emits this:
Warning: <stdin>:3: string ran past end of line
Error: <stdin>:3: syntax error near line 3
Modifying GraphViz::_as_generic() to do Encode::encode('utf-8', ..) on
$dot before running the dot-program makes the problem go away; I don't
know if that is the correct solution, though.
Removing "use utf8;" from the script also makes the problem go away - I
think that is a wrong solution.
This is with GraphViz 2.04 on Ubuntu 10.04 (lucid) and perl 5.10.1.