[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

Pull Request Overview

  • Opened on June 28, 2026
  • Status Open
  • Commit count 1 with first commit June 28, 2026

Total Delta

12 Total Diff Delta

Open Days

Open 60 weekdays

Test Delta

8 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Data pending calculation for pull request

Author avatar

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

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.

No comments have been left on this PR.