Ok, I used the reload(sys) hack for now:
http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/gramps.py?r1=20057&r2=20103

John, you say this is ugly, but are there disadvantages somewhere?
It is really annoying that with GTK3 we everywhere have conversions errors. I read that pango/cairo change the encoding in GTK2, so doing the hack gives us behaviour of before.

We cannot set a usersite module on installation of gramps as far as I can see.

Benny


2012/7/27 jerome <romjerome@yahoo.fr>
One (llange) has already proposed something like that!
http://www.gramps-project.org/bugs/view.php?id=4946#c19667

It sounded like to just set PYTHONHOME

$ export PYTHONHOME=..

then to set default encoding on 'gramps.py'!

+++ gramps/gramps.py
 #
 #-------------------------------------------------------------------------
 import sys
+reload(sys)
+sys.setdefaultencoding('utf8')

This could explain why we get same type of errors like we did not properly set an encoding (ex: an environment variables with an exotic encoding set) related to python 'sys' module! I will also test it on trunk under Ubuntu 12.04 (python 2.7.3), GTK 3.5.7 and pygobject 3.3.2.

Maybe Peter could test if the behavior will be also common under Windows OS (ex: path support)[1]?


Note, there is also a custom behavior with loaded compiled translations (path, config)! Currently, it is cosmetic and the only one place where I get this custom behavior is by updating _LANG_MAP under plugins/lib/libtranslate.py. Sorry for the 'common' description, but it is like we cannot make a dynamic update via simple paths and command line. I did not go further (new session, python on startup, etc ...), but this could be an OS issue/behavior/limitation under linux (do not know if others OS are also loading python under theirs desktops?)

This is not related to non-ASCII characters, but to my testing config!


[1] http://gramps.svn.sourceforge.net/viewvc/gramps?view=revision&revision=15905

Jérôme


--- En date de : Ven 27.7.12, Benny Malengier <benny.malengier@gmail.com> a écrit :

De: Benny Malengier <benny.malengier@gmail.com>
Objet: Re: [Gramps-devel] status GTK3 conversion - time reintegration branch
À: romjerome@yahoo.fr
Cc: "John Ralls" <jralls@ceridwen.us>, "Gramps Development List" <gramps-devel@lists.sourceforge.net>
Date: Vendredi 27 juillet 2012, 11h34

Jerome,

About encoding issues, I will try:

http://docs.python.org/library/sys.html#sys.setdefaultencoding

I think it is ok for Gramps to set this to utf-8.

Probably import pango and friends did this automatically, and we never where aware this was set, causing us now to add it by hand.

Benny

2012/7/20 Jérôme <romjerome@yahoo.fr>

Note, I get some problems (edition, non-ASCII characters, size of some

dialogs, etc ...) by trying GEPS 029 !



http://www.gramps-project.org/wiki/index.php?title=Talk:GEPS_029:_GTK3-GObject_introspection_Conversion






Le 20/07/2012 04:43, John Ralls a écrit :

>

> On Jul 10, 2012, at 9:18 AM, John Ralls wrote:

>

>>

>> On Jul 10, 2012, at 1:56 PM, Benny Malengier wrote:

>>

>>> All,

>>>

>>> The GTK3 branch is progressing nice. I finished today persontreeview, editnote.

>>> That means that at the moment editperson, editevent, editnote, listviews, and person treeview is working again in the GTK3 branch. Various other things also work, like quickviews, most gramplets, ...

>>>

>>> Much work remains. I will not have time to continue until 23 July.

>>> Instead of continuing then, I will merge further trunk changes in the branch and reintegrate the branch in trunk.

>>>

>>> That is, I consider proven that GTK3 can be made to work, so everybody will be forced to fix further issues in their code with GTK3 in trunk. I do  this because every code path must be retested. Yes, this is annoying, but necessary if we want a Gramps 4.0 version at the start of 2013 that is sufficiently stable.


>>>

>>> The main issue outside the gui code I encountered; is that since GTK3, unicode() and str(), no longer work on non ascii chars!! So it is needed to pass the encoding, I now pass 'utf-8' by default. This is not ideal. Best would be if we support python 3 and python 2.7 at the same time, and do the encoding cleanly. I would have to read up on how this is best done. Anyway, I assume this will be mostly a headache on windows.


>>>

>>> Known problems: http://www.gramps-project.org/wiki/index.php?title=GEPS_029:_GTK3-GObject_introspection_Conversion#Problems


>>>

>>> Feel free to already help out in this GEP branch before 23 July. I needed 4+ hours to merge trunk changes in this branch a week ago, so please don't do changes in trunk that will make my work again that complicated.


>>>

>>

>> There turn out to be some issues with Gtk3 itself with quartz. I've figured out at least part of it and will be committing the changes over the next week (that's to Gtk, not Gramps). There's also a small change in the way that one detects the backend with pygi, it's a one-line change that I'll get checked in to Gramps by this weekend. If all goes well I'll have gep-029 running on quartz before the 23rd.


>

> Using for a temporary workaround for Bug 675332 [1], I've now got gramps working more-or-less on Quartz. There are still some things that don't work right, but it's good enough for you to merge it into trunk.


>

> That said, Gtk3 itself now has built-in menu integration, but it requires converting Gramps to use GApplication. I think that this will have other benefits, but I do want to get agreement before I start in on it because it affects all platforms, not just Mac.


>

> Regards,

> John Ralls

>

> [1] https://bugzilla.gnome.org/show_bug.cgi?id=675332

>

>

> ------------------------------------------------------------------------------

> Live Security Virtual Conference

> Exclusive live event will cover all the ways today's security and

> threat landscape has changed and how IT managers can respond. Discussions

> will include endpoint security, mobile security and the latest in malware

> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

> _______________________________________________

> Gramps-devel mailing list

> Gramps-devel@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/gramps-devel

>





------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________

Gramps-devel mailing list

Gramps-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/gramps-devel