[Fix] `utils`: encode `+` as `%2B` in iso-8859-1 mode so values round-trip #565

Open
sarathfrancis90 opened 1:58am on June 28, 2026 wants to merge 12 Ξ” into ljharb/qs main from
iso-8859-1-encode-plus
Diff Delta:
12
About 45 Diff Delta/hour
Classified as:  General

sarathfrancis90's Description of Work

With charset: 'iso-8859-1', a literal + in a key or value is emitted unencoded, so it round-trips back as a space:

qs.stringify({ a: 'b+c' }, { charset: 'iso-8859-1' });

// 'a=b+c'
qs.parse('a=b+c', { charset: 'iso-8859-1' });
// { a: 'b c' } β€” the + became a space

The iso-8859-1 path encodes via escape, which leaves + untouched, but a + in a query string decodes to a space, so the value is silently corrupted. The utf-8 path already percent-encodes it (a=b%2Bc). I encode + as %2B in the iso-8859-1 branch too, matching utf-8, so values containing a + survive a round-trip.

2 total changed files
Loading changes...
Loading changes...
You’ve reached the end of the pull request
Your attention span may now revert to "default human"