unicode strings and strings mix
M.-A. Lemburg
mal at lemburg.com
Tue Jun 18 03:28:02 EDT 2002
Roman Suzi wrote:
> Is there any way to define "default" encoding so the following error
> will not happen?
>
>
>>>>unichr(0x3345) + "вавав"
>>>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> UnicodeError: ASCII decoding error: ordinal not in range(128)
>
>>>>unichr(0x3345) + "babab"
>>>
> u'\u3345babab'
There is, but it's better not to rely on it since it's a site
specific setting.
You should use unicode("вавав", "koi8-r") instead (or
define a wrapper for this like
def n(text):
return unicode(text, "koi8-r")
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting: http://www.egenix.com/
Python Software: http://www.egenix.com/files/python/
Meet us at EuroPython 2002: http://www.europython.org/
More information about the Python-list
mailing list