
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
iconv-urlencode
Advanced tools
Node ackage to encode and decode url-encoded strings from/to every possible encoding
Node package to encode and decode url-encoded strings from/to every possible encoding
This package uses iconv-lite for the encoding from/to different character sets. Therefore all encodings supported by this package can be used here.
The converted string is than url-encoded according to the HTML5 specification. The decoding works too - first url-decoded and than converted from the desired charset with iconv-lite.
convert given utf8 string to an url encoded ucs-2 string
var conv = require('iconv-urlencode');
var str = 'Oh du fröhliche...';
var urlStr = conv.encode(str, 'ucs-2');
convert an string used in an url with utf-7 encoding to local utf-8
var conv = require('iconv-urlencode');
var urlStr = 'Oh+du+fr%2BAPY-hliche...';
var str = conv.decode(urlStr, 'utf-7');
As Express, Request and Request-Promise packages insist of using utf-8 as the encoding for urls this package must be used to manually create the url params for some strange web services that do not adhere to the W3C sugessted utf-8 encoding.
var conv = require('iconv-urlencode');
var request = require('request');
var urlStr = 'https://example.org/test';
urlStr = urlStr + '?param1=' + conv.encode('bläh', 'win1252')
+ '¶m2=' + conv.encode('blĂĽb', 'win1252');
request.get(urlStr).then(function(response) {
// ... process get response here
});
MIT License
FAQs
Node ackage to encode and decode url-encoded strings from/to every possible encoding
We found that iconv-urlencode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.