den-run-ai / yapgvb

Automatically exported from code.google.com/p/yapgvb
0 stars 0 forks source link

Enable support to Unicode Labels e.g. Chinese Characters #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Current pure python release did not support Chinese Characters in Node label.
2.
3.

What is the expected output? What do you see instead?
Simplified Chinese in Nodes' label, but I got the system Error

What version of the product are you using? On what operating system?
latest pure python release

Please provide any additional information below.

It was caused by when yapgvb generate the dot template, it just use:
   f = open(xxx, 'w,), then print >> f.
   but this kind of file did not support unicode.

It is in the file graph_attribute_types.py:
I just add the import codecs, and use:
   f = codecs.open(f, encoding='utf8', mode='w+')
then it works well.

By the way, please add the magic string:
   # -*- encoding: utf-8 -*-
so it will better compatible to unicode

Thanks and best Regards!

Original issue reported on code.google.com by Eric.Le...@gmail.com on 16 Jul 2010 at 6:57