Encode a URL into a percent-encoded form, leaving already-encoded sequences alone. Useful for safely encoding user-controlled URLs for cases like building HTML output or header values, without throwing errors. It percent-encodes non-URL code points as UTF-8 and avoids re-encoding characters like “%” when it is part of a valid escape sequence.
Project status
- The source is actively maintained at present, with an upstream push and two updates in the week before 2026-11-05.
- The cadence is irregular: there was a long gap between v2.0.0 in March 2024 and the recent October 2026 updates, so a steady schedule is not evident.
AI summary generated
Recent updates
v3.0.0
v3.0.0 moves encodeurl from CommonJS to ESM, raises the minimum Node.js version to 22, and adopts a TypeScript build that ships declaration files. The implementation also changes its encoding path to improve performance and reduce package size.
BreakingFeaturesv2.0.1
v2.0.1 fixes encoding of consecutive unpaired UTF-16 surrogates by replacing each with U+FFFD while preserving valid surrogate pairs. The runtime API remains unchanged, but the diff also includes undocumented updates to development tooling and CI infrastructure.
v2.0.0
v2.0.0 changes encodeurl's percent-encoding behavior to better align with the WHATWG URL specification. The release specifically focuses on stopping encoding for the characters backslash, caret, and pipe, which also addresses a security concern described in the release notes.
BreakingSecurityv1.0.2
Release v1.0.2 contains a fix for how the module encodes a trailing percent sign character. The core code change adjusts the URL-encoding regex, and the test suite is updated accordingly to reflect the new behavior.
v1.0.1
Release v1.0.1 contains a targeted fix for how the library handles unpaired surrogate code points when they occur at the beginning or end of the input string. The code change updates the surrogate-detection regular expression to correctly match these edge positions, and the test suite was expanded to cover those cases.
v1.0.0
This release is version 1.0.0 and is labeled as the initial release. No release notes details are provided beyond stating that the project is newly published.