Beginner: problems with the win packages

Marcos Chaves marcos.nospam at gmail.com
Thu Nov 9 15:54:01 GMT 2006


On 11/9/06, Alexander Belchenko <bialix at ukr.net> wrote:
> 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.

Hi Alexander,

thanks for the info. I was thinking about a workaround similar to
this, just to get bzr to work for me.

> 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?
>

I tried your patch, and it works for me. The second part of the patch
(if _cached_user_encoding...) did not have any effect - the first part
solved the problem.

Your patch is similar to something that I was trying, but I still
didn't read all the posts about the problems that lead to the use this
mechanism to identify the best encoding, so I don't know if this is
appropriate. What I don't like about my approach (below) is that I
don't think it would be nice to list all the exceptions that people
find (if codepage == 'cp0'... ops, but then another user has 'cp1'...
and the other one just talked about 'cp2'...). What do you think?

--- bzrlib-orig/osutils.py      2006-11-09 12:14:10.000000000 -0200
+++ bzrlib/osutils.py   2006-11-09 12:14:04.000000000 -0200
@@ -364,9 +364,9 @@
     cp1252, but the console is cp437
     """
     output_encoding = getattr(sys.stdout, 'encoding', None)
-    if not output_encoding:
+    if not output_encoding or output_encoding == 'cp0':
         input_encoding = getattr(sys.stdin, 'encoding', None)
-        if not input_encoding:
+        if not input_encoding or input_encoding == 'cp0':
             output_encoding = bzrlib.user_encoding
             mutter('encoding stdout as bzrlib.user_encoding %r',
output_encoding)
         else:

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