[EMAIL PROTECTED] wrote:
> > Okay, I'll use one of the CJK codecs as the example. EUC-KR is the
> > default encoding.
> >
> > >>> import sys;sys.getdefaultencoding()
> > 'euc-kr'
> > >>> 'íê'
> > '\xc7\xd1\xb1\xdb'

That is the problem. Non-ascii characters in byte strings are
deprecated. Here is what I get when I run a deprecated hello
world program in Russian:
------- hello.py ---------
print "ÐÐÑÐÐÑÑÐÑÐ, ÐÐÑ!"
--------------------------
C:\py>c:\Python24\python.exe hello.py
sys:1: DeprecationWarning: Non-ASCII character '\xc7' in file
text.py on line 1,  but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details
âÑÐÑÑÑÐÑÑÑ, ÑÑÐ!
--------------------------
Oops, not only there is a warning, but it doesn't even work
on Windows in Russian locale. To correct the program I need
to switch to unicode strings:
------- hello.py ---------
# -*- coding: windows-1251 -*-
print u"ÐÐÑÐÐÑÑÐÑÐ, ÐÐÑ!"
--------------------------
C:\py>c:\Python24\python.exe hello.py
ÐÐÑÐÐÑÑÐÑÐ, ÐÐÑ!
--------------------------

Since non-ascii characters are deprecated in byte strings,
any non-ascii encoding for sys.getdefaultencoding() is
deprecated as well. Don't set it to 'euc-kr'.


> Any suggestions or any plans in future python versions?

In python 3.0 byte strings will be gone. So you won't be
able to put non-ascii characters into them.


  Serge.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to