New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

urlencode2

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlencode2

encodeURIComponent with charset

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
5
-50%
Maintainers
1
Weekly downloads
 
Created
Source

urlencode2 Build Status

encodeURIComponent with charset, e.g.: gbk

Install

$ npm install urlencode2

Usage

urlencode(string, charset)

var urlencode = require('urlencode2');

urlencode('苏千'); // default charset is utf8
urlencode('苏千', 'gbk'); // => '%CB%D5%C7%A7'

decode(string, charset)

urlencode.decode('%CB%D5%C7%A7', 'gbk'); // => '苏千'

parse(string, options)

// parse gbk querystring. support nest
urlencode.parse('nick=%CB%D5%C7%A7', {charset: 'gbk'});
// => {nick: '苏千'}

stringify(obj, options)

// stringify obj with gbk encoding. support nest
// equals: x[y][0][v][w]=%CE%ED%BF%D5
var str = 'x[y][0][v][w]=' + urlencode('雾空', 'gbk');
var obj =  {'x' : {'y' : [{'v' : {'w' : '雾空'}}]}};
urlencode.stringify(obj, {charset: 'gbk'}).should.equal(str);

License

MIT

Keywords

urlencode

FAQs

Package last updated on 06 Apr 2015

Did you know?

Socket

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.

Install

Related posts