You can read a utf8 encodec file with codecs.open too.<div><br></div><div><a href="http://docs.python.org/library/codecs.html">http://docs.python.org/library/codecs.html</a></div><div><br></div><div>Gonzalo</div><div> <br>
<br><div class="gmail_quote">On Mon, Aug 13, 2012 at 5:23 PM, Alan Jhonn Aguiar Schwyn <span dir="ltr"><<a href="mailto:alanjas@hotmail.com" target="_blank">alanjas@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><font face="Calibri" size="3">I have problems too..</font><div style="font-family:Calibri;font-size:12pt"><br></div><div style="font-family:Calibri;font-size:12pt">I load the strings from a file, and have that problems (even the file is UTF-8).</div>
<div style="font-family:Calibri;font-size:12pt"><br></div><div style="font-family:Calibri;font-size:12pt">My solution: when load a string, convert it:</div><div style="font-family:Calibri;font-size:12pt"><br></div><div><font face="Calibri">name_converted = unicode(name, 'UTF-8')</font><br>
<br><div style="font-family:Calibri;font-size:12pt"><div></div>> From: <a href="mailto:martin.langhoff@gmail.com" target="_blank">martin.langhoff@gmail.com</a><br>> Date: Mon, 13 Aug 2012 16:00:31 -0400<br>> To: <a href="mailto:humitos@gmail.com" target="_blank">humitos@gmail.com</a><br>
> CC: <a href="mailto:sugar-devel@lists.sugarlabs.org" target="_blank">sugar-devel@lists.sugarlabs.org</a><br>> Subject: Re: [Sugar-devel] Unicode strings in translations<div><div class="h5"><br>> <br>> On Mon, Aug 13, 2012 at 12:35 PM, Manuel Kaufmann <<a href="mailto:humitos@gmail.com" target="_blank">humitos@gmail.com</a>> wrote:<br>
> > To get Unicode strings from gettext I had to put these lines in my<br>> > lesssonscreen.py file:<br>> ><br>> > import gettext<br>> > gettext.install('po', unicode=True)<br>> <br>
> Awright. Seems like gettext hasn't realized that it's 2012 and<br>> defaults to using codepages.<br>> <br>> I'd vote for gettext.install('po', unicode=True) everywhere. All Sugar<br>> builds have been in the utf-8 era, so this should work even in<br>
> extremely old builds.<br>> <br>> <br>> <br>> <br>> m<br>> -- <br>> <a href="mailto:martin.langhoff@gmail.com" target="_blank">martin.langhoff@gmail.com</a><br>> <a href="mailto:martin@laptop.org" target="_blank">martin@laptop.org</a> -- Software Architect - OLPC<br>
> - ask interesting questions<br>> - don't get distracted with shiny stuff - working code first<br>> - <a href="http://wiki.laptop.org/go/User:Martinlanghoff" target="_blank">http://wiki.laptop.org/go/User:Martinlanghoff</a><br>
> _______________________________________________<br>> Sugar-devel mailing list<br>> <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">Sugar-devel@lists.sugarlabs.org</a><br>> <a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</div></div></div></div> </div></div>
<br>_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
<br></blockquote></div><br></div>