It unicode :
http://stackoverflow.com/questions/15092437/python-encoding-utf-8
What I don't understand is why to get those without the u''
>>> print u"ma\u00eft"
maït
>>> print u"ma\u00eft".encode('utf8')
maït
>>> u"ma\u00eft".encode('utf8')
'ma\xc3\xaft'
Inside web2py it should be : 'ma\xc3\xaft'
So I am not sure where the string that you mention come from these two :
"ma\u00eft" for first vars and
"li\u00e9" for the second vars
On Sat, Apr 23, 2016 at 4:48 PM, Mamisoa Andriantafika <[email protected]>
wrote:
> Hi,
>
> Using this usual REST code in controller :
>
> def api_users():
> response.view = 'generic.json' # or 'generic.' + request.extension
> def GET(*args,**vars):
> patterns = [
> "/user[auth_user]",
> "/user/{auth_user.id}",
> "/user/{auth_user.id}/:field",
>
> "/user/{auth_user.first_name.contains}/{auth_user.last_name.contains}/{auth_user.dob_pid7.eq}"
> ]
> db.auth_user.created_by.readable = db.auth_user.modified_by.readable
> = db.auth_user.created_on.readable = db.auth_user.modified_on.readable =
> True
> parser = db.parse_as_rest(patterns, args, vars)
> data = parser.response
> if parser.status == 200:
> return dict(content=data)
> else:
> raise HTTP(parser.status, parser.error)
>
> with the last pattern, if I use character with accent e.g:
>
> /user/maït/lié
>
> the query do not find match as it is not interpreted as:
>
> "ma\u00eft" for first vars and
> "li\u00e9" for the second vars
>
> which is the encoding I find when I do the request /user/ma/li .
>
> How can I correct the encoding transcription so that the request comply to
> the format:
>
> /user/maï/lié
>
> ?
>
> Mike
>
>
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.