[Python-Dev] ascii default encoding

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Mon, 17 Jul 2000 00:35:56 +0200


jack wrote:


> Now that the default encoding for 8-bit strings has gone back to
> "ascii", shouldn't the initialization of strop.whitespace and friends
> only range over 0..128 in stead of 0..256?
>=20
> On the Macintosh string.whitespace is '\011\012\013\014\015 \312', but =

> the \312 causes problems because it can't be converted from/to unicode =

> as long as the default encoding is ascii...

on windows and unix boxes, the default locale is "posix" (aka "C"),
which in practice means "plain ascii".  the only way to end up with
non-ascii characters in whitespace/uppercase/lowercase/etc is to
explicitly change the locale (by calling locale.setlocale).

how does this work on the mac?  do the mac libraries use another
default locale?

one slightly radical way to solve this would be to modify the loops
in stropmodule.c/initstrop (changing 256 to 128).

</F>