Module encoding
Encoding and decoding module, used to process the conversion between different data encoding formats and binary
Reference method:
1var encoding = require('encoding');
Object
base32
base32 Encoding and decoding module
1base32 encoding.base32;
base64
base64 Encoding and decoding module
1base64 encoding.base64;
hex
hex Encoding and decoding module
1hex encoding.hex;
iconv
iconv Encoding and decoding module
1iconv encoding.iconv;
json
json Encoding and decoding module
1json encoding.json;
msgpack
msgpack Encoding and decoding module
1msgpack encoding.msgpack;
Static function
jsstr
Encode a string into a javascript escaped string to include text in the javascript code
1
2static String encoding.jsstr(String str,
Boolean json = false);
Call parameters:
- str: String, the string to be encoded
- json: Boolean, whether to generatejsonCompatible string
Return result:
- String, Return the encoded string
encodeURI
url String safe encoding
1static String encoding.encodeURI(String url);
Call parameters:
- url: String, to be encoded url
Return result:
- String, Return the encoded string
encodeURIComponent
url Part string security encoding
1static String encoding.encodeURIComponent(String url);
Call parameters:
- url: String, to be encoded url
Return result:
- String, Return the encoded string
decodeURI
url Secure string decoding
1static String encoding.decodeURI(String url);
Call parameters:
- url: String, to be decoded url
Return result:
- String, Return the decoded string