{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback/issues/1900","repository_url":"https://api.github.com/repos/strongloop/loopback","labels_url":"https://api.github.com/repos/strongloop/loopback/issues/1900/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/1900/comments","events_url":"https://api.github.com/repos/strongloop/loopback/issues/1900/events","html_url":"https://github.com/strongloop/loopback/issues/1900","id":123068023,"number":1900,"title":"url encoded accented characters break the filter","user":{"login":"vl4dt","id":7919892,"avatar_url":"https://avatars2.githubusercontent.com/u/7919892?v=3","gravatar_id":"","url":"https://api.github.com/users/vl4dt","html_url":"https://github.com/vl4dt","followers_url":"https://api.github.com/users/vl4dt/followers","following_url":"https://api.github.com/users/vl4dt/following{/other_user}","gists_url":"https://api.github.com/users/vl4dt/gists{/gist_id}","starred_url":"https://api.github.com/users/vl4dt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vl4dt/subscriptions","organizations_url":"https://api.github.com/users/vl4dt/orgs","repos_url":"https://api.github.com/users/vl4dt/repos","events_url":"https://api.github.com/users/vl4dt/events{/privacy}","received_events_url":"https://api.github.com/users/vl4dt/received_events","type":"User","site_admin":false},"labels":[{"id":172069873,"url":"https://api.github.com/repos/strongloop/loopback/labels/triage","name":"triage","color":"d93f0b","default":false},{"id":135935296,"url":"https://api.github.com/repos/strongloop/loopback/labels/waiting","name":"waiting","color":"eeeeee","default":false}],"state":"closed","locked":false,"assignee":{"login":"loay","id":1986928,"avatar_url":"https://avatars0.githubusercontent.com/u/1986928?v=3","gravatar_id":"","url":"https://api.github.com/users/loay","html_url":"https://github.com/loay","followers_url":"https://api.github.com/users/loay/followers","following_url":"https://api.github.com/users/loay/following{/other_user}","gists_url":"https://api.github.com/users/loay/gists{/gist_id}","starred_url":"https://api.github.com/users/loay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loay/subscriptions","organizations_url":"https://api.github.com/users/loay/orgs","repos_url":"https://api.github.com/users/loay/repos","events_url":"https://api.github.com/users/loay/events{/privacy}","received_events_url":"https://api.github.com/users/loay/received_events","type":"User","site_admin":false},"assignees":[{"login":"loay","id":1986928,"avatar_url":"https://avatars0.githubusercontent.com/u/1986928?v=3","gravatar_id":"","url":"https://api.github.com/users/loay","html_url":"https://github.com/loay","followers_url":"https://api.github.com/users/loay/followers","following_url":"https://api.github.com/users/loay/following{/other_user}","gists_url":"https://api.github.com/users/loay/gists{/gist_id}","starred_url":"https://api.github.com/users/loay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loay/subscriptions","organizations_url":"https://api.github.com/users/loay/orgs","repos_url":"https://api.github.com/users/loay/repos","events_url":"https://api.github.com/users/loay/events{/privacy}","received_events_url":"https://api.github.com/users/loay/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2015-12-19T07:00:27Z","updated_at":"2017-03-14T16:02:42Z","closed_at":"2016-02-11T16:07:14Z","body":"This condition occurs when I have to query any list or call the findOne method and specify a filter with some accented character in any string value, I don't know if there is another way to send the filter, maybe as a json payload but it doesn't work either.\n\nExample:\n\n**This works:**\nOriginal object:\n\n``` json\n{\"filter\":{\"where\":{\"name\":\"John Doe\"}}}\n```\n\nhttp://localhost:3000/api/organizacions?**_filter=%7B%22where%22%3A+%7B%22nombre%22%3A+%22John+Doe%22%7D%7D_**\n\n**This fails**\nOriginal object:\n\n``` json\n{\"filter\":{\"where\":{\"name\":\"John Doé\"}}}\n```\n\n**_filter=%7B%22where%22%3A+%7B%22name%22%3A+%22John+Do%5Cxc3%5Cxa9%22%7D%7D_**\n\nError stack trace:\n\n``` json\n{\"error\":{\"name\":\"Error\",\"status\":400,\"message\":\"invalid value for argument \\'filter\\' of type \\'object\\': where. Received type was string. Error: Unexpected token w\",\"statusCode\":400,\"stack\":\"Error: invalid value for argument \\'filter\\' of type \\'object\\': where. Received type was string. Error: Unexpected token w\\\\n    at new badArgumentError (/Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/shared-method.js:268:13)\\\\n    at coerceAccepts (/Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/shared-method.js:324:13)\\\\n    at SharedMethod.invoke (/Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/shared-method.js:217:16)\\\\n    at HttpContext.invoke (/Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/http-context.js:384:12)\\\\n    at /Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/remote-objects.js:620:11\\\\n    at execStack (/Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/remote-objects.js:460:7)\\\\n    at RemoteObjects.execHooks (/Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/remote-objects.js:464:10)\\\\n    at /Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/strong-remoting/lib/remote-objects.js:617:10\\\\n    at /Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/loopback/lib/application.js:358:13\\\\n    at /Users/vl4dt/Projects/progetti/api/sfapvsdb/node_modules/loopback/lib/model.js:313:7\"}}\n```\n\nI'm calling the service from Python, I notice the api explorer handles this differently, different encoded url:\n**_filter=%7B%22where%22%3A%7B%22nombre%22%3A%22John%20Do%C3%A9%22%7D%7D_**\n\nI'm using **urllib.urlencode**, how should I encode the params, one difference I noticed right away was that urlencode was using **%27** instead of **%22**, had to have it replaced before using the url.\n\nThe call is being made through urlfetch.\n\nAny thoughts?\n"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback/issues/comments/286469113","html_url":"https://github.com/strongloop/loopback/issues/1900#issuecomment-286469113","issue_url":"https://api.github.com/repos/strongloop/loopback/issues/1900","id":286469113,"user":{"login":"Cu4rach4","id":14967132,"avatar_url":"https://avatars1.githubusercontent.com/u/14967132?v=3","gravatar_id":"","url":"https://api.github.com/users/Cu4rach4","html_url":"https://github.com/Cu4rach4","followers_url":"https://api.github.com/users/Cu4rach4/followers","following_url":"https://api.github.com/users/Cu4rach4/following{/other_user}","gists_url":"https://api.github.com/users/Cu4rach4/gists{/gist_id}","starred_url":"https://api.github.com/users/Cu4rach4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cu4rach4/subscriptions","organizations_url":"https://api.github.com/users/Cu4rach4/orgs","repos_url":"https://api.github.com/users/Cu4rach4/repos","events_url":"https://api.github.com/users/Cu4rach4/events{/privacy}","received_events_url":"https://api.github.com/users/Cu4rach4/received_events","type":"User","site_admin":false},"created_at":"2017-03-14T16:02:42Z","updated_at":"2017-03-14T16:02:42Z","body":"i have allmost the same problem, i'm using http for request on the same Strongloop server (i dont know how to call internal), but returns:\r\n\r\n[SyntaxError: Unexpected token w]\r\n\r\nThis is the code:\r\n\r\n`\r\nGetDevicebyChannel: function  (channelId, callback){\r\n\r\n\t\tvar filter = {\r\n\t\t\t\"where\":{\r\n\t\t\t\t\"idchannelsts\": channelId\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// console.log(JSON.stringify(filter));\r\n\t\t// http://localhost:3000/api/Channelsts?filter={\"where\":{\"idchannelsts\":218200}}&access_token=panky\r\n\r\n\t\t\toptions = {\r\n\t\t\t\thostname: 'localhost',\r\n\t\t\t\tport: 3000,\r\n\t\t\t\tpath: '/api/Channelsts?filter=' +  JSON.stringify(filter) + '&access_token=' + token_API,\r\n\t\t\t\tmethod: 'GET',\r\n\t\t\t\theaders: {\r\n\t\t\t\t\t'Accept': 'application/json',\r\n\t\t\t\t    'Content-Type': 'application/json'\r\n\t\t\t\t  }\r\n\t\t\t\t// protocol: 'https'\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log (options.path);\r\n\r\n\t\t\thttp.request(options, callbackHttp).end(function () {\r\n\t\t\t\t callback(Respjson);\r\n\t\t\t});\r\n\r\n\t\t\tconsole.log(JSON.stringify(filter));\r\n`\r\n\r\nwhen i use console.log (options.path) on browser works without any throuble!..\r\n\r\n> \r\nhttp://localhost:3000/api/Channelsts?filter={\"where\":{\"idchannelsts\":218200}}&access_token=Panky\r\n\r\nReturns: \r\n\r\n> [{\"idchannelsts\":218200,\"namechannel\":\"AgroDoc_llahuen_piloto\",\"usuariosIdusuarios\":1,\"iddevice\":\"d0001p\"}]"}}
{"actor":{"display_login":"Cu4rach4"}}