First bazaar-ng experience

Martin Pool mbp at sourcefrog.net
Thu Jun 30 02:34:10 BST 2005


On 29 Jun 2005, John A Meinel <john at arbash-meinel.com> wrote:

> Just add these lines right after it:
> if user_encoding is None:
>    user_encoding='UTF-8'

Good catch.  

> I think that will at least stop it from failing on you.
> Now the trick is to figure out what the default encoding should be if
> getpreferredencoding() should fail.
> On my linux box, it seems to be "UTF-8", under cygwin it is "US_ASCII",
> on windows it seems to be 'cp1252'.
> On *my* mac it seems to be 'mac-roman'.
> 
> Now, we could default it based on sys.platform, but really the point is
> that the system should be setting a preferred encoding.
> I'm not sure why your mac is not.
> 
> I would actually argue that the best fallback encoding is utf-8, since
> it means you should be able to encode any international characters.

It'll produce invalid output on 3 of the 4 example platforms you list :(

I think ascii is probably the only safe cross-platform default.  It
seems like a Python bug if locale.getpreferredencoding returns None.

-- 
Martin




More information about the bazaar mailing list