This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Cannot decode/encode anything!
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: lemburg, tzot, zarxos
Priority: normal Keywords:

Created on 2003-08-14 01:07 by zarxos, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (7)
msg17750 - (view) Author: Joe Smith (zarxos) Date: 2003-08-14 01:07
Whenever I use any of the decode methods in the codecs
package, or use a string's encode or decode method, I
get the error: UnicodeDecodeError: 'ascii' codec can't
decode byte 0x88 in position 0: ordinal not in
range(128). That character it's referring to is a ê (e
with circonflex if you can't see it for whatever
reason). I don't know why this is happening, and I've
tried a dozen different ways to try and get it to work.
Please fix this horrible bug! I can't decode any files! 
msg17751 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2003-08-14 08:17
Logged In: YES 
user_id=38388

The ASCII codec can't handle non-ASCII characters
and that's perfectly normal. Please provide more
context.
msg17752 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2003-08-18 07:34
Logged In: YES 
user_id=539787

Joe, does this code work for you?

s = '\x88'
u = s.decode('cp850')

If it does work fine, then either you don't supply the 
<encoding> argument to decode/encode, or you try to print 
the result; in either of these two cases, it's not a Python bug.

PS Since e-circumflex is \x88 for you, I assume you run this in 
the Python command line.
msg17753 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2003-08-18 07:35
Logged In: YES 
user_id=539787

Joe, does this code work for you?

s = '\x88'
u = s.decode('cp850')

If it does work fine, then either you don't supply the 
<encoding> argument to decode/encode, or you try to print 
the result; in either of these two cases, it's not a Python bug.

PS Since e-circumflex is \x88 for you, I assume you run this in 
the Python command line.
msg17754 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2003-08-18 07:39
Logged In: YES 
user_id=539787

Joe, does this code work for you?

s = '\x88'
u = s.decode('cp850')

If it does work fine, then either you don't supply the 
<encoding> argument to decode/encode, or you try to print 
the result; in either of these two cases, it's not a Python bug.

PS Since e-circumflex is \x88 for you, I assume you run this in 
the Python command line.
msg17755 - (view) Author: Χρήστος Γεωργίου (Christos Georgiou) (tzot) * Date: 2003-08-18 07:41
Logged In: YES 
user_id=539787

Forgive my multiple posting (SF reported an error), and 
substitute "Windows command line" for "Python command line" 
in the last paragraph.
msg17756 - (view) Author: Joe Smith (zarxos) Date: 2003-08-19 00:50
Logged In: YES 
user_id=826905

Yes I am using Python command line. What else would I use? 
Anyway, your method works too, but someone told me to put 
u"ê".encode('cp437') in my code and that works. Thank you 
anyway.
History
Date User Action Args
2022-04-10 16:10:38adminsetgithub: 39063
2003-08-14 01:07:54zarxoscreate