The goal is to receive the right result from the query in the GET request.

As you saw, in the first query I get the result of the user that where 
first name, name and dob correspond to the parameters.

But when I had the accented character, I cannot get the expected same 
result.

>From the first response, one can see that the query may have been done in 
UTF8. So I think that I should feed the GET request with a kind of UTF8 
encoded characters, although I'm already in UTF8?

Le dimanche 24 avril 2016 14:57:23 UTC+2, Richard a écrit :
>
> I don't understrand... Are you trying to generate this URL or you receive 
> the request? Does it fails for a request you receive?
>
> On Sat, Apr 23, 2016 at 8:38 PM, Mamisoa Andriantafika <[email protected] 
> <javascript:>> wrote:
>
>> Just to be clearer, here is a response from the following get:
>>
>>
>> https://localhost/test/default/api_users/user/ma/li/1978-01-01
>>
>>
>>
>>
>> {"content": [{"birth_country_pid23": "France", "first_name":
>> "Ma\u00eft", "last_name": "Li\u00e9", "modified_by": null,
>> "id": 42, "gender_pid8": 2, "created_by": null, "birth_town_pid23":
>> "Paris", "ssn_pid19": "", "created_on": "2016-04-23 15:59:49",
>> "modified_on": "2016-04-23 15:59:49", "maiden_name_pid6":
>> "Li\u00e9", "idc_num": "", "dob_pid7": "1978-01-01"}]}
>>
>>
>> but if I add the search with the accent:
>>
>>
>> https://localhost/test/default/api_users/user/maï/lié/1978-01-01
>>
>>
>>
>>
>> {"content": []}
>>
>>
>>
>>
>> ??
>>
>> Le samedi 23 avril 2016 22:48:29 UTC+2, Mamisoa Andriantafika a écrit :
>>>
>>> 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] <javascript:>.
>> 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.

Reply via email to