non standard path characters

Tijs tijs_news at bluescraper.com
Thu May 31 08:41:14 EDT 2007


Robin Becker wrote:

> A kind user reports having problems running the reportlab tests because
> his path has non-ascii characters in it eg
> 
> .....\Mes documents\Mes Téléchargements\Firefox\...
> 
> somewhere in the tests we look at the path and then try and convert to
> utf8 for display in pdf.
> 
> Is there a standard way to do these path string conversions?
> 
> Paths appear to come from all sorts of places and given the increasing use
> of zip file packaging it doesn't seem appropriate to rely on the current
> platform as a single choice for the default encoding.

Zip files contain a bit flag for the character encoding (cp430 or utf-8),
see the ZipInfo object in module zipfile and the link (on that page) to the
file format description.
But I think some zip programs just put the path in the zipfile, encoded in
the local code page, in which case you have no way of knowing.

-- 

Regards,
Tijs



More information about the Python-list mailing list