Closed GoogleCodeExporter closed 9 years ago
If you are using python 2.x you could encode your unicode strings before
passing them to add_node method:
e.g. G.add_node(unicode('€€€','utf8').encode('utf8'))
Original comment by tomaz.ko...@gmail.com
on 26 Jul 2011 at 4:07
Yes, that works. But unfortunately not for the dot writer. And it is not
possible to read in dot or markup files written like that.
Original comment by pebo...@gmail.com
on 3 Aug 2011 at 1:31
Hello. Have you tried specifying the file encoding?
The following works fine (but fails if the comment line is removed):
#! -*- coding: utf-8 -*-
from pygraph.classes.graph import graph
from pygraph.readwrite.markup import write, read
gr = graph()
gr.add_node("aló")
print gr
xml = write(gr)
print xml
print read(xml)
Original comment by pmatiello
on 3 Aug 2011 at 10:41
Yes, that works. I already specified the encoding in my scripts. As I wrote in
my ticket, I have Unicode strings, i.e. gr.add_node(u"aló") does not work.
What is the difference here? Do I really have to encode everything as UTF-8
before passing it to the graph?
Original comment by pebo...@gmail.com
on 4 Aug 2011 at 9:28
If we use the unicode() call in markup.py, strings using characters outside the
standard 127-bits ascii range must be formed as unicode literals. The following
would program fail:
gr = graph()
gr.add_node("olá")
xml = write(gr)
To make it work, the second line would have to be:
gr.add_node(u"olá")
And this would be a regression.
Original comment by pmatiello
on 6 Aug 2011 at 1:41
Original comment by pmatiello
on 6 Aug 2011 at 1:42
Original issue reported on code.google.com by
pebo...@gmail.com
on 26 Jul 2011 at 10:51