[Python-3000] Unicode and OS strings

Jim Jewett jimjjewett at gmail.com
Fri Sep 14 15:39:31 CEST 2007


On 9/14/07, Hagen Fürstenau <hagenf at coli.uni-sb.de> wrote:
> Is it too unreasonable to keep the byte strings we get from the OS as
> byte strings in Python (since we're not sure about their encoding) and
> offer functions for getting strings?

> sys.argv could be of type bytes and sys.arguments (or whatever) could be
> a function taking an encoding parameter (which defaults to UTF-8) and
> returning strings.

> Of course that's backwards incompatible and I'm not sure if it's too
> late for something like this now.

For that reason alone, it makes sense to do it the other way.
sys.argv is the text string, and sys.arguments is a bytes object which
can be decoded if you know the encoding.  sys.argv ==
sys.arguments(best_guess)

-jJ


More information about the Python-3000 mailing list