First bazaar-ng experience

John A Meinel john at arbash-meinel.com
Wed Jun 29 17:56:49 BST 2005


Uros Trebec wrote:

>>Can you try running just "bzr version" and if that fails, give us a
>>snippet from the last portion of ~/.bzr.log?
>>The specific problem seems to be that the python code:
>>import locale
>>user_encoding = locale.getpreferredencoding()
>>
>>Is returning None for your preferred encoding. Do you know what your
>>actual encoding is?
>>What do we thing a default should be if None is returned? latin-1, utf-8?
>>
>>Does anyone know how to set the preferred encoding? I know you can try
>>setting LC_ALL or LANG, something like
>>LC_ALL='en.utf8' bzr version
>>
>>John
>>=:->
>>
>>
>
>The last advice doesn't work :(
>
...
Just for the sake of argument, try the following, in the file:
$bzrroot/bzrlib/__init__.py
There is the following lines:
import locale
user_encoding = locale.getpreferredencoding()
del locale

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

>Uros
>
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.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050629/4de897cd/attachment.pgp 


More information about the bazaar mailing list