The question doesn't seem to call itself out, so I'll place it
separately as well....



Ok to the ^^^QUESTION^^^...

I have unicode working great, but for some reason when using the Auth
plugin and the webhelpers url_for method I still need to explicitly
encode the variable as utf-8.  This seems a bit hacky though.  Anyone
else get into a similar situation and/or have a more elegant solution
(or am I just doing something wrong here)?

Here's a snippet of the code I'm using for that:

--------------------------------------------------------------------
snippet for Auth problem
--------------------------------------------------------------------
    def signin_method(self):
        uname = request.params.get('username',
'').strip().encode('utf-8', 'replace')      <----- throws a
UnicodeDecodeError if not first doing an encode
        request.environ['paste.auth_tkt.set_user'](uname)

--------------------------------------------------------------------
url_for problem
--------------------------------------------------------------------
${ h.url_for('page', nickname=notebook.user.nickname,
notebook_id=notebook.book_id, highlight = c.query.encode('utf-8',
'replace')

where highlight becomes a param so the url would look something like:
/users/me/1/?highlight=úñicode_phrase

thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to