How to troubleshoot Chinese garbled characters in JS and how to troubleshoot the garbled characters in vs open JS files

Source: Internet
Author: User

When Javascript is used, Chinese characters cannot be properly displayed, because the encoding method is incorrect.

The homepage solves the problem of JS Chinese garbled characters: use NotePad to open the JS file and save it as "UTF-8" to overwrite the previous file. In this way, the preview will not contain garbled characters such as alert and document. Write in JS;

If Javascript is written in an HTML file, add the charset element of Meta to the file header as UTF-8.

<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>

If Javascript is written in an HTML file, add the charset element of Meta to the file header as UTF-8.

<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>

Next, if you use vs2005 to open this JS file, all Chinese characters and garbled characters will be displayed. The solution is to select automatic UTF-8 detection in VS 2005 settings.

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.