GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — querystring result not consistent with encodeURIComponent · Issue #5309 · nodejs/node

querystring result not consistent with encodeURIComponent #5309

New issue
Copy link
New issue
Copy link
Closed
Closed
querystring result not consistent with encodeURIComponent#5309
Copy link
Labels
querystringIssues and PRs related to the built-in querystring module.

Description

@jacobp100
jacobp100
opened on Feb 18, 2016
Issue body actions

QueryString has a comment that states the following,

   // replaces encodeURIComponent
   // http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4

However, the spec states that you should use ToString. In the code, you’re using ValueOf. I.e.

const x = { valueOf: function() { return 'other result'; }, toString: function() { return 'spec result'; } }
encodeURIComponent(x) !== require('querystring').escape(x)

Activity

  1. Fishrock123
    added
    querystringIssues and PRs related to the built-in querystring module.
    on Feb 18, 2016
  2. silentroach commented on Feb 20, 2016

    @silentroach
    silentroach
    on Feb 20, 2016
    Contributor
    More actions

    first comment is about querystring.escape and it really replaces encodeURIComponent the way you expect.

    > require('querystring').escape({test: 5, toString: () => 10})
    '10'
    

    if you mean querystring.stringify - it is not a replacement to encodeURIComponent.

  3. jacobp100 commented on Feb 20, 2016

    @jacobp100
    jacobp100
    on Feb 20, 2016
    Author
    More actions

    No, I am talking about querystring.escape. If you take the object I gave you and run it through both encodeURIComponent and querystring.escape, you will get different results.

  4. silentroach commented on Feb 20, 2016

    @silentroach
    silentroach
    on Feb 20, 2016
    Contributor
    More actions

    got that, sorry. lets try to fix it :)

  5. jasnell
    closed this as completedin 5dafb43on Apr 12, 2016
  6. jasnell
    added a commit that references this issue on Apr 26, 2016

    querystring: using toString for objects on querystring.escape

    5c8b597
  7. sjarmak
    added a commit that references this issue on Jul 27, 2026

    querystring: using toString for objects on querystring.escape

    5dafb43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    querystringIssues and PRs related to the built-in querystring module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.