[問題] Draw graph 時node無法標中文的問題

看板Python作者 (Mark)時間12年前 (2013/04/16 18:12), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/1
大家好, 我安裝pydot後 照下面的例子 可以產生圖形 (node的名字為英文時) http://pythonhaven.wordpress.com/2009/12/09/generating_graphs_with_pydot/ 但我要改成中文就會出現以下訊息 pydot.InvocationException: Program terminated with status: 1. stderr follows: Error: Invalid 2-byte UTF8 found in input. Perhaps "-Gcharset=latin1" is needed? 我想應該是編碼的問題 (我最怕面對的) 所以請問有無高手可以告訴我如何解決此問題 感謝! 我是用Python 2.7 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.128.102.37

04/16 19:01, , 1F
試試看 u'中文' 或是 '中文'.decode('big5')
04/16 19:01, 1F

04/16 19:01, , 2F
我這邊中文可以正常出現
04/16 19:01, 2F
文章代碼(AID): #1HRIGD92 (Python)
文章代碼(AID): #1HRIGD92 (Python)