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
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/leo-editor/-/r7DKp65D6NsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.