问题
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