odata-v4-parser icon indicating copy to clipboard operation
odata-v4-parser copied to clipboard

Parsing strings with special character failures

Open erickakoyama opened this issue 6 years ago • 3 comments
trafficstars

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:

  1. Fails when a hash mark is in the string activities/last7Days eq 'Page#pageViewed#343521056969328528'

  2. Fails when a '%' is in any side but '/' is ok activities/Page/pageViewed%012345 lt '2018-07-08T:09:30:00.000Z'

  3. 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

erickakoyama avatar Apr 16 '19 23:04 erickakoyama

Just noticed the same with the following example: Field ne 'yes/no'

flashtheman avatar Feb 26 '20 10:02 flashtheman

Did you find any workaround for this?

ashutoshns avatar Apr 05 '21 17:04 ashutoshns

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__

kienD avatar Apr 05 '21 18:04 kienD