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.

Author loewis
Recipients lemburg, loewis, tarek
Date 2008-04-08.20:16:06
SpamBayes Score 0.023209
Marked as misclassified No
Message-id <47FBD282.1050803@v.loewis.de>
In-reply-to <1207661184.56.0.396312221678.issue2562@psf.upfronthosting.co.za>
Content
> 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().
Files
File name Uploaded
P1-1.0.tar.gz loewis, 2008-04-08.20:16:05
History
Date User Action Args
2008-04-08 20:16:07loewissetspambayes_score: 0.023209 -> 0.023209
recipients: + loewis, lemburg, tarek
2008-04-08 20:16:06loewislinkissue2562 messages
2008-04-08 20:16:06loewiscreate