UnicodeError: ASCII encoding error: oridinal not in range(128)
Doru-Catalin Togea
doru-cat at ifi.uio.no
Tue Jul 16 18:04:38 EDT 2002
More information about the Python-list mailing list
Tue Jul 16 18:04:38 EDT 2002
- Previous message (by thread): UnicodeError: ASCII encoding error: oridinal not in range(128)
- Next message (by thread): Bug? interactive echo clobbering softspace of redirected stdout?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi! The following code works well (as expected) when the "tmplText" variable contains only english characters. f = open(htmlPrefix + htmlFileName, 'w') f.write(tmplText) f.close() The same code fails when "tmplText" comes from an XML files which contains norwegian characters (latin-1 extension), like ΓΈ, in the data, not in the tags, with the following error message: Traceback (most recent call last): File "./python/genh1.py", line 335, in ? f.write(tmplText) UnicodeError: ASCII encoding error: oridinal not in range(128) I have found the same behaviour for the builtin "print" function. print() works well with norwegian text in the Interactive Window of PythonWin IDE. What kind of strings do write() and print() handle? Hopefully I can convert my strings to that type. I am running ActiveState Python 2.2 on win 2000 Pro. Any help is appreciated. Thank you. Catalin <<<< ================================== >>>> << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> <<<< ================================== >>>>
- Previous message (by thread): UnicodeError: ASCII encoding error: oridinal not in range(128)
- Next message (by thread): Bug? interactive echo clobbering softspace of redirected stdout?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list