Reputation: 582
I am trying to filter the search contents from OneDrive Search API. This is the request without the filter where the original query keyword is 中英字典 whose UTF-8 encoded value is %25E4%25B8%25AD%25E8%258B%25B1%25E5%25AD%2597%25E5%2585%25B8
The request without the filter is like this.
The use case is to find the matching keyword
in the name
so I need add a filter like filter=contains(name,'$keyword')
.
The corresponding request with the filter is
The first request will give me the correct results for both ascii and non-ascii characters, but the second one gives me the correct results only for ascii characters and does not work for url-encoded UTF-8 characters (only returns empty results).
I have tried encodings from this post as well but they also do not work.
Is this a bug from OneDrive or am I using a wrong type of encoding for $filter
?
Upvotes: 0
Views: 356
Reputation: 830
Use it:
urlFilter += ` and indexof(Name,'` + encodeURIComponent(this.Name) + `') gt -1`;
this.Name
comes from my input.
Copied from my working project.
Upvotes: 1