"hiral" <hiralsmaill...@gmail.com> wrote in message
news:90b62600-a0a4-47d5-bb6f-a3ae14cf6...@9g2000prn.googlegroups.com...
Hi,
I tried...
<code>
# coding: latin-1
print "**********************************************************"
oo = "ö"
print "char=<%s>" % oo
print "**********************************************************"
</code>
but it is not printing "ö" char; any idea?
1) Make sure you save your source in the encoding declared, or change the
encoding to match. Any encoding that supports ö will work.
2) Use Unicode strings.
3) Only print characters your terminal supports, or you will get a
UnicodeEncoding error.
Below works in PythonWin GUI (utf-8 encoding) and US-Windows console (cp437
encoding).
<code>
# coding: latin-1
print u"**********************************************************"
oo = u"ö"
print u"char=<%s>" % oo
print u"**********************************************************"
</code>
Coding line declares *source* encoding, so Python can *decode* characters
contained in the source.
"print" will *encode* characters to the terminal encoding, if known.
-Mark
--
http://mail.python.org/mailman/listinfo/python-list