On Mon, Sep 1, 2008 at 3:25 PM, <[EMAIL PROTECTED]> wrote: > > When I do ${urllib.unquote(c.user.firstName)} without encoding to > latin-1 I got different chars than I will get: no Łukasz but Å ukasz > -- > http://mail.python.org/mailman/listinfo/python-list
That's crazy. "string".encode('latin1') gives you a latin1 encoded string; latin1 is a single byte encoding, therefore taking the first byte should be no problem. Have you tried: urlib.unquote(c.user.firstName)[0].encode('latin1') or urlib.unquote(c.user.firstName)[0].encode('utf8') I'm assuming here that the urlib.unquote(c.user.firstName) returns an encodable string (which I'm absolutely not sure), but if it does, this should take the first 'character'. Regards Marco -- Marco Bizzarri http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list