Skip to content

Commit

Permalink
Merge bc0518d into 37208d1
Browse files Browse the repository at this point in the history
  • Loading branch information
n-piipel committed Aug 27, 2019
2 parents 37208d1 + bc0518d commit 99c8508
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pygraphviz/agraph.py
Expand Up @@ -180,7 +180,7 @@ def __init__(self, thing=None,
# get the encoding from the "charset" graph attribute
item = gv.agget(self.handle, b'charset')
if item is not None:
self.encoding = item
self.encoding = item if type(item) is not bytes else item.decode('utf-8')
else:
self.encoding = _DEFAULT_ENCODING
else:
Expand Down Expand Up @@ -1742,8 +1742,8 @@ def __init__(self, handle, atype):
ghandle = gv.agraphof(handle)
root_handle = gv.agroot(ghandle) # get root graph
try:
ah = gv.agattr(root_handle, 0, b'charset', None)
self.encoding = gv.agattrdefval(ah)
item = gv.agattrdefval(gv.agattr(root_handle, 0, b'charset', None))
self.encoding = item if type(item) is not bytes else item.decode('utf-8')
except KeyError:
self.encoding = _DEFAULT_ENCODING

Expand Down Expand Up @@ -1834,8 +1834,8 @@ def __init__(self, handle, atype):
# get the encoding
root_handle = gv.agroot(self.ghandle) # get root graph
try:
ah = gv.agattr(root_handle, 0, b'charset', None)
self.encoding = gv.agattrdefval(ah)
item = gv.agattrdefval(gv.agattr(root_handle, 0, b'charset', None))
self.encoding = item if type(item) is not bytes else item.decode('utf-8')
except KeyError:
self.encoding = _DEFAULT_ENCODING

Expand Down

0 comments on commit 99c8508

Please sign in to comment.