classification
Title: quopri encoding & Unicode
Type: Stage:
Components: Unicode Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, lemburg, zenzen
Priority: normal Keywords:

Created on 2004-01-24 03:57 by zenzen, last changed 2007-09-03 07:17 by georg.brandl. This issue is now closed.

Messages (5)
msg19799 - (view) Author: Stuart Bishop (zenzen) Date: 2004-01-24 03:57
2.3 currently has the following behaviour:

>>> 'hello world'.encode('quopri')
'hello=20world'
>>> 'hello world'.encode('quopri').decode('quopri')
'hello world'
>>> u'hello world'.encode('quopri')
'=00h=00e=00l=00l=00o=00=20=00w=00o=00r=00l=00d'
>>> u'hello world'.encode('quopri').decode('quopri')
'\x00h\x00e\x00l\x00l\x00o\x00 \x00w\x00o\x00r\x00l\x00d'

I think the quoted printable encoding method should
either implicitly convert Unicode strings to US-ASCII,
or raise an exception.
msg19800 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2004-01-26 20:38
Logged In: YES 
user_id=38388

A change to StringIO/cStringIO would be needed to change this,
unless you want to add a special case to the codec testing
for Unicode.

I don't have time to look into this, sorry.
msg55473 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-08-30 10:22
This is the same issue you can see with
cStringIO.StringIO(u"abc").getvalue().  This behavior will not be
changed, as per #1730114.

Marc-Andre: would it be okay to add an explicit str() call in the
StringIO calls in quopri_codec and uu_codec, so that non-ASCII unicode
strings give an error on decode(), as binascii.b2a_qp() does?
msg55477 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2007-08-30 13:15
Georg: Yes, sure.
msg55606 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-09-03 07:17
Okay, changed in rev. 57925. Closing this as fixed.
History
Date User Action Args
2007-09-03 07:17:14georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg55606
2007-08-30 13:15:56lemburgsetmessages: + msg55477
2007-08-30 10:22:30georg.brandlsetnosy: + georg.brandl
messages: + msg55473
2004-01-24 03:57:42zenzencreate