How to read gzipped utf8 file in Python?

John Nagle nagle at
Thu Nov 22 21:07:53 CET 2007

   I have a large (gigabytes) file which is encoded in UTF-8 and then
compressed with gzip.  I'd like to read it with the "gzip" module
and "utf8" decoding.  The obvious approach is

	fd =, 'rb',encoding='utf8')

But "" doesn't support an "encoding" parameter.  (It
probably should, for consistency.)  Is there some way to do this?
Is it possible to express "unzip, then decode utf8" via

				John Nagle

More information about the Python-list mailing list