Nodejs garbled processing

Source: Internet
Author: User

1. Handling echo Garbled

Res.write ("

2. Handling the parameter garbled

Querystring.escape (str)

Escape to encode an incoming string

Querystring.escape

Querystring.escape ("name= mu bai");/*return: ' NAME%3D%E6%85%95%E7%99%BD ' * *

Querystring.unescape (str)

Unescape method to decode a string containing%

Querystring.unescape

Querystring.unescape (' name%3d%e6%85%95%e7%99%bd ');/*return: ' name= mu Bai ' * *

Specific: http://www.cnblogs.com/whiteMu/p/5986297.html

3. Coding-related code (I'm Useless)

var encoding = require ('encoding'); var iconv = require ('iconv-lite'); Console.log (Encoding.convert ("%e7%9a%84 %e5%a3%ab%e9%80%9f%e9%80%92 "," Utf-8 "));
Console.log (Iconv.decode ('%e7%9a%84%e5%a3%ab%e9%80%9f%e9%80%92'utf-8  '));

Nodejs garbled processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.