Beginner: problems with the win packages
Marcos Chaves
marcos.nospam at gmail.com
Thu Nov 9 01:20:32 GMT 2006
Hi John.
On 11/8/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
> 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'm running Windows XP SP2 with all the patches and upgrades (except
for IE7 - I want to be sure it will not blow everything here).
Also, I don't think I have any special encondig installed. My XP is
in English, but I have regional settings (like numeric format) set
to Brazilian Portuguese. Also, my keyboard is set to "United States
- International", so I can get non-ASCII characters on a standard US
keyboard. But that's all, I think.
I already used non-ASCII characters with Python, and I just had to
have my first line as...
# coding: iso-8859-1
...and everything worked fine, also with the outputs.
>
> 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"
>
This sounds exotic to me too.
>
> 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.
>
At least for me, it does:
C:\>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getfilesystemencoding()
'mbcs'
>>> ^Z
>
> 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).
Sure!
>
> John
> =:->
>
Thanks for the quick reply.
-Marcos
More information about the bazaar
mailing list