[I18n-sig] Re: [Python-Dev] Pre-PEP: Python Character Model

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed, 7 Feb 2001 00:50:52 +0100

> Yes. Why wouldn't it?
> You haven't specified an encoding for the file write so it would default
> to what it does today. You aren't using any large characters so there is
> no need for multi-byte encoding.

I'm certainly using characters > 128. In UTF-8, they would become
multi-byte. I'm not certain whether this would cause a problem; you
did not give all implementation details of your approach, so it is
hard to say. 

For example, f.write would use the s# conversion (since the file was
opened in binary). What exactly would that do?

If your change would be to *just* widen the internal representation of
characters, it would do PyString_AS_STRING/PyString_GET_SIZE, so it
would return a pointer to the internal representation. As a result,
writing the MAGIC would result in only two bytes of the magic being
written, with intermediate \0 bytes; that would be wrong.