1. The module introduced querystring
var qs = require('querystring')
2. converting portion query string as an object thereof
qs.parse(str)
example:
var str = 'name=zs&age=12&set=男' console.log(qs.parse(str));
Print Results:
{ name: 'zs', age: '12', set: '男' }
3. The query object into form
qs.stringify(obj)
example:
var obj = { name:'ls', age:13, } console.log(qs.stringify(obj));
Print Results:
name=ls&age=13
4.qs.unescape (str) usage:
If there follows an object, value Chinese values comprising:
var obj = { name:'ls', age:13, sex:'女' }
This object is converted into a string query:
qs.parse(obj)
The result is this:
name=ls&age=13&sex=%E5%A5%B3
So this time we should solve coding problems, use qs.unescape (str)
qs.unescape(qs.parse(obj))
The results obtained did not [garbled] the
name=ls&age=13&sex=女