Martin v. Löwis <[EMAIL PROTECTED]> added the comment:

> But write_pkg_file will use ascii encoding if we don't indicate it
> here:
> 
>>>> pkg_info.write('Author: %s\n' % self.get_contact() )

Why do you say that it uses ascii? It uses whatever encoding the string
returned by get_contact uses. See the attached P1-1.0.tar.gz for an
example. This doesn't use ASCII, and doesn't use UTF-8, and works with
2.4.

> So wouldn't a light fix in write_pkg_file() would be sufficient when a
> unicode(field) fails, as MAL mentioned ? by trying utf8:
> 
>>>> try:
> ...    pkg_info.write('Author: %s\n' % self.get_contact() )
> ... except UnicodeEncodeError:
> ...    pkg_info.write('Author: %s\n' % self.get_contact().encode('utf8') ) 

That would work - although I fail to see what this has to do with
a failing unicode(field). Instead, it has rather to do with a failing
.write().

Added file: http://bugs.python.org/file9987/P1-1.0.tar.gz

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2562>
__________________________________

Attachment: P1-1.0.tar.gz
Description: GNU Zip compressed data

_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to