You have to put a 'u' in front of strings if you want unicode strings. 
Otherwise you are getting utf-8 strings.
so, prefix your quoted strings with a u like so:

patterns = [
            u"/name/{user.username}",
            u"/email/{user.email}",
            ]

On Friday, May 30, 2014 7:56:50 PM UTC-7, Thomas P wrote:
>
> I am getting weird results when passing in cyrillic strings, or strings 
> that contain characters like ® in the name pattern.
>
> If I do a search with another patter like email against the same user, the 
> username with cyrillic will display correctly.
>
>
> I tried dumping the request.args and this is what displays where the name 
> being searched should be  ____________
> If I pass the same string into a variable in request.vars the string will 
> display correctly.
>
>
> The the string I am searching for in my database is дерьмо and ®ob
>
> /name/дерьмо   == bad results
> /name/®ob == bad results
>
>
> Anyone know what could be the issue?
>
>
>
> @request.restful()
> def api():
>     response.view = 'generic.json'
>     def GET(*args,**vars):
>         patterns = [
>             "/name/{user.username}",
>             "/email/{user.email}",
>             ]
>         parser = forum_db.parse_as_rest(patterns,args,vars)
>         if parser.status == 200:
>             return dict(results=parser.response)
>         else:
>             raise HTTP(parser.status,parser.error)
>     return locals()
>
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to