ljharb / qs

A querystring parser with nesting support
BSD 3-Clause "New" or "Revised" License
8.47k stars 731 forks source link

qs.parse decoder option doesn't work on IOS web view environment #455

Open logone72 opened 1 year ago

logone72 commented 1 year ago

My app is currently using web view with creating and parsing query string with qs.

qs.parse(location.search.replace('?', ''), { decoder: decodeURIComponent });

Like above, I'm passing decodeURIComponent as decoder for qs.parse()

The problem is, on IOS web view environment, it returns un-decoded string(the result of encodeURIComponent).

is there some underlying conditions on decoder option?

it works fine on pc browser, and android browser.

ljharb commented 1 year ago

decodeURIComponent is not a valid decoder function when used directly; you have to wrap it in a valid one.