zlib, gzip and HTTP compression.

Martin v. Loewis martin at v.loewis.de
Sun Jan 13 22:14:58 CET 2002

alanmk at hotmail.com (Alan Kennedy) writes:

> So the character translation was happening on the file descriptor
> itself? Is that standard C behaviour? 

Standard C says that stdout is a text stream, see 7.19.3p7:

# At program startup, three text streams are predefined and need not
# be opened explicitly standard input (for reading conventional
# input), standard output (for writing conventional output), and
# standard error (for writing diagnostic output).

That, in turn, means that system-specific things may happen to it

# A text stream is an ordered sequence of characters composed into
# lines, each line consisting of zero or more characters plus a
# terminating new-line character. Whether the last line requires a
# terminating new-line character is implementation-defined. Characters
# may have to be added, altered, or deleted on input and output to
# conform to differing conventions for representing text in the host
# environment. Thus, there need not be a one-to- one correspondence
# between the characters in a stream and those in the external
# representation. Data read in from a text stream will necessarily
# compare equal to the data that were earlier written out to that
# stream only if: the data consist only of printing characters and the
# control characters horizontal tab and new-line; no new-line
# character is immediately preceded by space characters; and the last
# character is a new-line character. Whether space characters that are
# written out immediately before a new-line character appear when read
# in is implementation-defined.


More information about the Python-list mailing list