Subject: | unicode bug in GraphViz2 |
Hi,
first of all, thanks for rewriting GraphViz, which I use regularly.
I've found a bug in GraphViz2 which isn't present in GraphViz. Check the
two scripts attached, and execute them with with an utf8 string as first
arg, e.g.:
perl test_gv.pl gräm
1) For GraphViz2 to work, you have to either comment out "use open
':locale';", or comment in "no encoding;"
2) GraphViz will even automatically encode your string if needed, so
"$name = encode( 'utf8', $name );" can be omitted.
I haven't looked too far into the code what is creating this problem
(I've been fighting with other unicode bugs all day, and now my eyes
hurt), however I hope you can reproduce the bug.
I'm using Perl 5.14.2 and GraphViz2 2.01.
Thanks for your time.
Regards,
Lee
Subject: | test_gv2.pl |
#!/usr/bin/env perl
use Modern::Perl '2012';
use GraphViz2;
use open ':locale';
use Encode;
my $g = GraphViz2->new();
my $name = shift;
say 'before decoding: ', $name;
$name = decode( 'utf8', $name );
say 'after decoding: ', $name;
$name = encode( 'utf8', $name );
say 'after encoding: ', $name;
#no encoding;
$g->add_node(name => $name);
$g->run(
format => 'svg',
output_file => 'test_gv2.svg'
);
Subject: | test_gv.pl |
#!/usr/bin/env perl
use Modern::Perl '2012';
use GraphViz;
use open ':locale';
use Encode;
my $g = GraphViz->new();
my $name = shift;
say 'before decoding: ', $name;
$name = decode( 'utf8', $name );
say 'after decoding: ', $name;
$name = encode( 'utf8', $name );
say 'after encoding: ', $name;
#no encoding;
$g->add_node(name => $name);
$g->as_svg('test_gv.svg');