Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

Report information
The Basics
Id: 75451
Status: resolved
Priority: 0/
Queue: GraphViz

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.04
Fixed in: (no value)



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.
On Thu Mar 01 10:08:28 2012, http://asjo.koldfront.dk/ wrote: Show quoted text
> 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.
Here is a patch doing that. Still not sure it is the correct thing to do.
Subject: octets_for_run.patch
--- GraphViz.pm.orig 2012-02-21 11:24:43.559073190 +0100 +++ GraphViz.pm 2012-03-01 16:32:17.158447471 +0100 @@ -7,6 +7,7 @@ use Carp; use Config; use IPC::Run qw(run binary); +use Encode (); # This is incremented every time there is a change to the API $VERSION = '2.04'; @@ -1192,7 +1193,9 @@ my $program = $self->{LAYOUT}; - run [ $program, $type ], \$dot, ">", binary(), $out; + # Pass octets to IPC::Run::run lest it chops off the end of $dot: + my $octets=Encode::encode('utf-8', $dot); + run [ $program, $type ], \$octets, ">", binary(), $out; return $buffer unless defined $output; }
Subject: Re: [rt.cpan.org #75451] UTF-8 characters makes GraphViz chop off the end of the dot-file
Date: Fri, 02 Mar 2012 07:58:10 +1100
To: bug-GraphViz [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Adam On 02/03/12 02:08, http://asjo.koldfront.dk/ via RT wrote: Show quoted text
> If there are labels with utf-8 characters in them, GraphViz cuts off the > end of the dot-file, making the resulting graphs incomplete.
Thanx for the report and analysis of the problem. I definitely want to fix the problem, but want to do it in a way which preserves all current functionality. Can you please email me a sample file as an attachment so I don't have to cut-and-paste from an email. Send it to ron@savage.net.au. $many x $thanx; -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Subject: Re: [rt.cpan.org #75451] UTF-8 characters makes GraphViz chop off the end of the dot-file
Date: Tue, 06 Mar 2012 18:01:35 +1100
To: bug-GraphViz [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Adam I've made some changes to GraphViz2 to accommodate utf8. I do realize you submitted a bug report about GraphViz, not GraphViz2, but I don't intend to make any more changes to GraphViz. It is deprecated. You can see the sample output here: http://savage.net.au/Perl-modules/html/graphviz2/utf8.svg I'm releasing GraphViz2 V 2.00 now. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Resolved in V 2.01. See the docs for details.
From: asjo [...] koldfront.dk
Hi Ron, On Thu Mar 01 15:57:55 2012, ron@savage.net.au wrote: Show quoted text
> Thanx for the report and analysis of the problem. I definitely want to > fix the problem, but want to do it in a way which preserves all current > functionality.
Sounds great! Sorry I didn't get back to you sooner - I had logged in using OpenID and didn't get any emails (probably because RT doesn't know the email-address corresponding to my OpenID). I am happy to hear that you have solved the problem in GraphViz2 - I am using GraphViz on an Ubuntu 10.04 machine and installing GraphViz2 is not trivial (it depends on a newer Module::Build, newer DBI and all sorts of stuff), so that is why I reported the bug on GraphViz only. I will use my hack locally with GraphViz until I get the option of running GraphViz2. Thanks for the modules and the bugfix! Best regards, Adam
Subject: Re: [rt.cpan.org #75451] UTF-8 characters makes GraphViz chop off the end of the dot-file
Date: Thu, 08 Mar 2012 09:22:45 +1100
To: bug-GraphViz [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Adam On 08/03/12 00:41, asjo@koldfront.dk via RT wrote: Show quoted text
> Queue: GraphViz > Ticket<URL: https://rt.cpan.org/Ticket/Display.html?id=75451> > > Hi Ron, > > On Thu Mar 01 15:57:55 2012, ron@savage.net.au wrote: >
>> Thanx for the report and analysis of the problem. I definitely want to >> fix the problem, but want to do it in a way which preserves all current >> functionality.
> > Sounds great! > > Sorry I didn't get back to you sooner - I had logged in using OpenID and > didn't get any emails (probably because RT doesn't know the > email-address corresponding to my OpenID).
Hehehe - technology... Show quoted text
> I am happy to hear that you have solved the problem in GraphViz2 - I am > using GraphViz on an Ubuntu 10.04 machine and installing GraphViz2 is > not trivial (it depends on a newer Module::Build, newer DBI and all > sorts of stuff), so that is why I reported the bug on GraphViz only.
OK. Thanx for the background info. If it's your own machine you could just install the pre-reqs for GraphViz2.pm, and then the module itself :-). Show quoted text
> I will use my hack locally with GraphViz until I get the option of > running GraphViz2.
OK. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Resolved in GraphViz2 V 2.01