Apostrophe issue in url with OData

余生长醉 提交于 2020-01-05 04:09:26

问题


I am using oData protocol which add the filter criteria in the url

E.g. /api/restaurants/getall?$filter=substringof('macdonald',Name)

My problem when the value has apostrophe like (macdonald's) it will break the url

It works fine if I replace it with %26 like macdonald%26 but by adding s (macdonald%26s) the url will not work

any suggestions?


回答1:


When inside the quoted string a single quote can be escaped by doubling it. So in your case it would look like 'macdonald''s'.




回答2:


I see this is an old post, but I'll point out that the arguments in the substringof expression are switched.

https://help.nintex.com/en-us/insight/OData/HE_CON_ODATAQueryCheatSheet.htm

This is aside from the apostrophe (single quote) problem.



来源:https://stackoverflow.com/questions/15517529/apostrophe-issue-in-url-with-odata

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!