odata-v4-parser
odata-v4-parser copied to clipboard
Parsing strings with special character failures
Hi, thanks for the parsing functions ⚡️ . I am parsing a filter odata string like this and receiving parser errors for special characters in certain strings. For example:
-
Fails when a hash mark is in the string
activities/last7Days eq 'Page#pageViewed#343521056969328528' -
Fails when a '%' is in any side but '/' is ok
activities/Page/pageViewed%012345 lt '2018-07-08T:09:30:00.000Z' -
Fails when a '/' is in any side but '%' is ok
count(foo='activities/Page%23pageViewed%23012345 lt 2018-07-08T:09:30:00.000Z',bar='gt',baz=100)'
Here is a codesandbox with the test: https://codesandbox.io/embed/618478m2vn
Is there a recommendation for what we can do to handle these cases? Thank you very much 🙏
Version: 0.1.29
Just noticed the same with the following example: Field ne 'yes/no'
Did you find any workaround for this?
Did you find any workaround for this?
We got around it by just replacing the special characters with a placeholder value before passing it through the odata parser and then finding the value and replacing it with the original char after. It's not a perfect solution but it works.
e.g. ? with __SOMETHINGQUESTIONMARK__