Christopher Barker wrote:
> I suppose what I would like is if I could change the default encoding
> that str() uses -- or at least change it to "replace" or "ignore" mode.
You can, with sys.setdefaultencoding(). See here for discussion of how:
http://blog.ianbicking.org/illusive-setdefaultencodin
[EMAIL PROTECTED] wrote:
> Chris> So how to I get Python to convert to utf-8 with a print
> Chris> statement, instead of ascii?
>
> The print statement can't do it directly, but you can encode Unicode objects
> using different charsets then print the result. Try this:
> >>> print uni
Chris> So how to I get Python to convert to utf-8 with a print
Chris> statement, instead of ascii?
The print statement can't do it directly, but you can encode Unicode objects
using different charsets then print the result. Try this:
>>> unicode("\xef", "latin-1")
u'\xef'
>>
Hi all,
I generally use Terminal.app as my terminal with python.
With all the default settings, it appears to be a showing up as an ascii
terminal to python. This means that if I do:
print UnicodeObject
it tried to encode it as ascii, which often fails.
However, it seems that OS-X is pretty u