From: Benny M. <ben...@gm...> - 2009-06-29 14:31:14
|
Peter and windows interested people Gerald has started to move code again to the key attribute with strxfrm as the cmp method of sort is deprecated in python 3.0, and next version of GRAMPS tries to be as compatible as possible. Also, this sort is often fasten. For my listview changes, I also need to use strxfrm as I need to be able to insert via the bisect module, so strings should sort correctly with the < operator only to enable this. So, if this problem is windows is important to you, you should take it upstream. I suggest first a bug submission with python, and if they say it is a C lib issue on windows, then with Microsoft. Original bug that will be present in Trunk again: http://www.gramps-project.org/bugs/view.php?id=2504 Perhaps best to reopen this bug and link to an upstream bug submission Benny 2009/6/25 Benny Malengier <ben...@gm...>: > 2009/6/25 Peter Landgren <pet...@te...>: > >> >> I have tried to get my little Python script to work in WinXP, but somehow Python under win >> report it uses encoding 'cp1252' (Latin 1 I think). My test strings are in UTF-8, so the >> collating will be wrong. I have tried to change window coding to UTF-8, but without >> success. It's strange that the sort works in Gramps, and not in my little scipt? > > python works with str and utf internally, and can convert to the > system encoding as needed (in and out). So that will be an extra layer > you have on win. You can probably work around that with the encoding > stuff in python, so convert the utf to binary string, and then to the > encoding you have.... > Encodings are complicated though, I try to stay away from it :-) > > Benny > >> >> It works OK in Linux. >> >> I also installed Python 3 on my Win box, and after some conversion of the program I have a >> similar problem with 'cp1252'. >> >> I'm stuck for now. >> >> /Peter >> >> > |