question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stringify with arrayFormat: comma, wrongfully encode comma in return

See original GitHub issue

wrong result with stringifying

qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' }) return a=b%2Cc

when it should return a=b,c

because parsing , as reserved character per RFC 3986 should split the array if we used a parser withcomma: true option and %2C (percent encoded comma) should be treated normally as text character

related to : #336 pr

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ananiycommented, Dec 21, 2020

using { encode: false } options to fix this

1reaction
coatesapcommented, Nov 17, 2020

This doesn’t actually appear to have been fixed. The latest version still outputs a=b%2Cc. In fact the unit test also confirms that is the current behaviour:

st.equal(
  qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma' }),
  'a=b%2Cc%2Cd',
  'comma => comma'
);

Surely this is wrong though, as it means you can’t encode values that have commas in themselves?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Output array as comma separated with querySelector
qs.stringify(oData, { arrayFormat: 'comma', encode: false }). encode: false is also used so the commas aren't URL encoded. With an input of:
Read more >
str_getcsv - Manual - PHP
Parses a string input for fields in CSV format and returns an array containing the ... These tools do not escape commas or...
Read more >
DAML SDK Documentation
We will see how we encode this in DAML in the next section. ... You can have many, either as a comma-separated list...
Read more >
auth0-js - UNPKG
'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (opts ... charsetSentinel,\n comma: typeof opts.comma === 'boolean' ? opts.comma ......
Read more >
parse.rs - source - GitHub Pages
These functions can return any syntax tree node that //! implements the [`Parse`] ... terminated by commas with //! // an optional trailing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found