Comment 6 for bug 794353

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 794353] Re: ascii is a bad default filesystem encoding

On 10/18/2011 01:53 AM, Martin Pool wrote:
> On 18 October 2011 06:07, Jelmer Vernooij <email address hidden>
wrote:
>> Related, it would be nice if sys.getfilesystemencoding() would return
>> 'utf8' on Ubuntu (isn't the policy that it has to be utf8?) rather than
>> depending on some environment variables as appears to be the case at the
>> moment.
>
> In particular it depends on $LANG, and in the reasonably common case
> of LANG=C or LANG='' you get ANSI_X3.4-1968 (ie ascii.)
>
> As Barry says, Ubuntu doesn't want to deviate from upstream. Upstream
> Python always trusts nl_langinfo(CODESET) which gives this result.
>
> This is a little hard to work around from bzr because the filesystem
> encoding is held in a C variable and accessed directly from some
> internal C routines. But it may be possible.
>
> It seems like our options include:
> - give a clear error telling the user to use a unicode locale
I think this alone would be a big step forward; giving a nice error
message explaining people what to do isn't as good as Doing The Right
Thing, but a lot better than printing a incomprehensible traceback.
>
> - possibly file a Python bug complaining there's no way to override
> the fs encoding
That seems like a good idea, independent of what bzr ends up doing.

Cheers,

Jelmer