summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2007-08-22 16:15:07 +0200
committerSylvain <syt@logilab.fr>2007-08-22 16:15:07 +0200
commitdac0e1b119afe6bb24e8de05ec886049d99d8b43 (patch)
tree567b02ea091d6208f2dfb061eeaaa2e860f9b4cc
parent003e937d1d05c0ee003fd0e80e865fc001df305c (diff)
downloadlogilab-common-dac0e1b119afe6bb24e8de05ec886049d99d8b43.tar.gz
explicit charset declaration in the dot file
-rw-r--r--graph.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/graph.py b/graph.py
index 3ed0902..2d32dee 100644
--- a/graph.py
+++ b/graph.py
@@ -30,7 +30,7 @@ def target_info_from_filename(filename):
class DotBackend:
"""Dot File backend"""
- def __init__(self, graphname, rankdir=None, size=None, ratio=None):
+ def __init__(self, graphname, rankdir=None, size=None, ratio=None, charset='utf-8'):
self.graphname = graphname
self.lines = []
self._source = None
@@ -41,6 +41,10 @@ class DotBackend:
self.emit('ratio=%s' % ratio)
if size:
self.emit('size="%s"' % size)
+ if charset:
+ assert charset.lower() in ('utf-8', 'iso-8859-1', 'latin1'), \
+ 'unsupported charset %s' % charset
+ self.emit('charset="%s"' % charset)
def get_source(self):
"""returns self._source"""