Here's a question that's puzzled me for a long time. I use bbedit to edit python code. Running the code from within the editor, as I understand it, spawns its own python process, runs the code, and writes the output to a log file. So bbedit doesn't know about environment variables and such. If I try this at the command line in a terminal:
>>> s = 'háček'
>>> print s
háček
find and good. But if I have the following file in bbedit:
#!/opt/local/bin/python
# -*- coding: utf-8 -*- #
s = u'háček'
print s
and try to run it from within the editor I get:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128)
so I have to do this:
print s.encode('utf-8')
Can anyone familiar with bbedit illuminate for me what's going on here? Is there a way to tell the editor how to behave in the presence of unicode characters?
Thanks, Jon