Beginner: problems with the win packages

Alexander Belchenko bialix at ukr.net
Thu Nov 9 07:56:00 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marcos Chaves пишет:
> On 11/9/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
>> Can you try:
>>   python -c "import sys; print sys.stdout.encoding"
>>
>> Because it sounds like that may be giving 'cp0'.
> 
> This gives me "cp0".
> 
>>
>> Which would mean we want to change 'bzrlib/osutils.py' the function
>> 'get_terminal_encoding()'.
> 
> If I force this function to 'utf8' or 'cp1252', then it works for me.
> 
> Also, I noticed that if I try "chcp", it gives me:
> 
> Active code page: 0
> 
> ....but if I try...
> 
>> chcp 1252
> Active code page: 1252
> 
> ....and then run Bazaar, it works, but only for the current session.

In short term you can force your codepage with chcp command.

If you are want to use version from installer you only need manually add
'chcp' command to launching batch files.

For standalone bzr.exe in folder where bzr installed there is file
start_bzr.bat. You can add command

@chcp 1252

to the start of this batch file. And then every time open console for
bzr session either via Start -> Programs -> Bazaar menu or via Context
menu in Explorer. I hope it works for you.

If you wish to use python-based version you also need to add the same
command before invocation of python interpreter.


In long term I think we need explicitly check for codepage 'cp0' and
treat them as 'ascii' and/or fallback to bzrlib.user_encoding that seems
to have valid value. John, what you think about this patch:

=== modified file 'bzrlib/osutils.py'
- --- bzrlib/osutils.py   2006-11-02 07:29:02 +0000
+++ bzrlib/osutils.py   2006-11-09 07:53:01 +0000
@@ -372,6 +372,10 @@
             mutter('encoding stdout as sys.stdin encoding %r',
output_encoding)
     else:
         mutter('encoding stdout as sys.stdout encoding %r',
output_encoding)
+    if output_encoding == 'cp0':
+        output_encoding = bzrlib.user_encoding
+        mutter('cp0 is invalid encoding.'
+               ' encoding stdout as bzrlib.user_encoding %r',
output_encoding)
     return output_encoding


@@ -1085,7 +1089,7 @@
                          "  Continuing with ascii encoding.\n"
                          % (e, os.environ.get('LANG')))

- -    if _cached_user_encoding is None:
+    if _cached_user_encoding in (None, 'cp0'):
         _cached_user_encoding = 'ascii'
     return _cached_user_encoding


Marcos, can you try this patch on your system? Is it works for you?


Alexander

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUt8QzYr338mxwCURArLNAJ9b5UO0tZTlgaUEvuRsI09Ko5rUVACfeswU
Qbo9hY8/FQ4/zfPPDSVr/Kg=
=6JGm
-----END PGP SIGNATURE-----





More information about the bazaar mailing list