Note from EKR: I mistakenly banned this user, which trashed the message. I've unbanned the user, and here is the message:
QQQ
I started the scripting tutorial and the first lines
for p in c.all_positions():
indent = '.' * p.level()
print('%s%s' % (indent,p.h))get me this error:
"UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 3: ordinal not in range(128)"QQQ
This script only works if no headline contains non-ascii text. Sorry about that. Here is a script that works, assuming your text is utf-8 encoded::
@first # -*- coding: utf-8 -*-
for p in c.all_positions():
indent = '.' * p.level()
print('%s%s' % (indent,g.toUnicode(p.h))
On Windows, this will print "byte hash" if the encoding of your character doesn't match the encoding of the console, but that is another matter :-)
HTH. Unicode is a complex subject. Please feel free to ask more questions.
Edward