Opened 10 years ago

Last modified 9 years ago

#4760 new defect

Fix for Markup(map) with unicoded strings when using MasterTicketsPlugin depgraph

Reported by: Dmitry Shurupov Owned by: Christian Boos
Priority: high Component: GraphvizPlugin
Severity: normal Keywords: unicode
Cc: Trac Release: 0.11


I'm using MasterTicketsPlugin with GraphvizPlugin. And I have some cyrillic symbols in my tickets. When I was trying to create a depgraph for any ticket, I was getting this error:

Trac detected an internal error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 43: ordinal not in range(128)

That's the source of this problem:

File "build/bdist.linux-x86_64/egg/depgraph/", line 146, in process_requestFile "build/bdist.linux-x86_64/egg/depgraph/", line 240, in expand_macroFile "build/bdist.linux-x86_64/egg/graphviz/", line 406, in expand_macro

I don't know Python language, but I've figured how to fix it. I've changed the "open(map_path, 'r')" to ", 'r', 'utf-8')" and added "import codecs". Now, this problem has gone, and everything seems to work.

Patch for graphvizplugin 0.11-0.7.4 is attached. Feel free to make something more reasonable than stupid code from non-python (non-)programmer.

Attachments (1)

graphvizplugin-unicoded-map-depgraph.patch (592 bytes) - added by Dmitry Shurupov 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Dmitry Shurupov

comment:1 Changed 10 years ago by anonymous

Had the same problem, not involving the MasterTicketsPlugin, but was trying to generate a map file with URLs/labels with utf-8 characters. Did the exact same fix, here is the patch...

Index: 0.11/graphviz/
--- 0.11/graphviz/	(revision 5353)
+++ 0.11/graphviz/	(working copy)
@@ -23,6 +23,7 @@
 import sha
 import subprocess
 import sys
+import codecs
 from genshi.builder import Element, tag
 from genshi.core import Markup
@@ -402,7 +403,7 @@
         # for binary formats, add map
         elif URL_in_graph and os.path.exists(map_path):
-            f = open(map_path, 'r')
+            f =, 'r', 'utf-8')
             map = f.readlines()
             map = "".join(map).replace('\n', '')

comment:2 Changed 10 years ago by anonymous

This GraphvizPlugin macro triggers an "Genshi UnicodeDecodeError error while rendering template"

Error: Failed to load processor graphviz
No macro or processor named 'graphviz' found

(replace UniformResourceLocator with its three-letter abbreviation, I tried this to get past the spam filter)

The above patch(es) fixes this issue.

comment:3 Changed 10 years ago by anonymous

Now, really! I forgot this would be interpreted as a macro call :-)

digraph G {
Sundström [UniformResourceLocator=Sundström]

and again, replace UniformResourceLocator? with its three-letter abbreviation...

comment:4 Changed 9 years ago by Christian Boos

Keywords: unicode added
Owner: changed from Peter Kropf to Christian Boos
Priority: lowhigh
Severity: trivialnormal

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain Christian Boos.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.