Beginner: problems with the win packages

John Arbash Meinel john at arbash-meinel.com
Wed Nov 8 23:04:59 GMT 2006


Marcos Chaves wrote:
> Hi,
> 
> I'm new to Bazaar, so I hope I'm not doing anything terrible wrong.
> 
> I just installed Bazaar 0.12.0 windows installer
> (bzr-0.12.0.win32.exe) and I have Python 2.4.3 installed. I'm getting
> these errors:
> 
> - - - - - 8< - - - - -
> 
> C:\Python24\Scripts> bzr
> 
> bzr: ERROR: exceptions.LookupError: unknown encoding: cp0


What version of Windows are you running? It sounds like you have some
sort of internationalized version, which is defaulting the console
encoding to 'cp0'.

I can't say that I've seen that encoding before, and it would seem that
python hasn't either.

The closest thing I could find using google is this link:
http://www.abisource.org/mailinglists/abiword-dev/01/April/0164.html

Which says:
 "Exotic locales such as Hindi and Georgian cause asserts in libiconv
  though loading either as UTF-8 display fine. This seems to be due
  Windows supporting as Unicode locales only"

and the response:

 "Windows actually returns "CP0" for these Unicode locales. I'll look
  into this further tomorrow but basically it means no separate 8 bit
  code page exists so input and file formats are all 100% Unicode. I'm
  not sure what the iconv and EncodingManager ramifications of this are"

It sounds like we should either tree 'CP0' as "ASCII", or "UTF-8". The
specific code which is checking this is bzrlib/osutils.py the function
'get_user_encoding()'.

Which uses 'locale.getpreferredencoding()', which I would guess is
querying windows for the code page, and is getting back "CP0".

I would assume 'sys.getfilesystemencoding()' would still be returning
'mbcs'. So we could still support versioning unicode filenames. But we
wouldn't be able to print them to the console.

Which is probably fine, since I don't think the console could print them
anyway.

This patch may make it work:
=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py   2006-11-02 07:29:02 +0000
+++ bzrlib/osutils.py   2006-11-08 23:03:41 +0000
@@ -1085,7 +1085,10 @@
                          "  Continuing with ascii encoding.\n"
                          % (e, os.environ.get('LANG')))

-    if _cached_user_encoding is None:
+    # Windows returns 'cp0' to indicate there is no code page. So we'll
just
+    # treat that as ASCII, and not support printing unicode characters
to the
+    # console.
+    if _cached_user_encoding in (None, 'cp0'):
         _cached_user_encoding = 'ascii'
     return _cached_user_encoding


Are you comfortable playing around with python source code? I can try to
talk you through it if you want. (You need to use the Windows Native
Python-based installer, and then edit 1 file).

John
=:->

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


More information about the bazaar mailing list