tsroten / dragonmapper

Identification and conversion functions for Chinese text processing
MIT License
54 stars 18 forks source link

empty string returned from hanzi.to_pinyin() #11

Closed astromme closed 8 years ago

astromme commented 8 years ago

I'm trying to use dragonmapper to convert characters to pinyin, and I'm trying the tutorial but I'm stuck. http://dragonmapper.readthedocs.org/en/latest/tutorial.html

from dragonmapper import hanzi
s = '这个字怎么念?' 
pinyin = hanzi.to_pinyin(s)

At this point pinyin is an empty string u''. What am I doing wrong?

astromme commented 8 years ago

Oh, I need to mark the string as unicode:

s = u'这个字怎么念?'