From: Peter L. <pet...@te...> - 2010-01-02 11:29:07
|
If I run this code with Swedish (or other non English) locale I get: q1 = _('unknown') q2 = _(u'unknown') print type(q1), len(q1), q1 print type(q2), len(q2), q2 print q1 == q2 <type 'str'> 6 okänd <type 'str'> 6 okänd True However, if I run with English locale I get: <type 'str'> 7 unknown <type 'unicode'> 7 unknown True So the translation process changes the type of the q2 string from unicode, as it is by definition, to 'str' I think this is the reason why we many times must call unicode() to get the correct result. See issue http://www.gramps-project.org/bugs/view.php?id=3480 for the latest example. Could this cause other errors too? /Peter |