简体   繁体   中英

Save JavaScript files using Notepad as Encoding of Ansi or UTF-8

I'm new at web development and JavaScript, I know that each html5 and Css file should be set as UTF-8 if it's included more than ANSI, but what about JavaScript? what simple to do when it comes to save a JavaScript file? I'm using windows7, save the file as ANSI or UTF-8? Please see this attached image when saving a JavaScript using windows7 Notepad . Thanks for your helps and answers..

Your script files inherit their character encoding declarations from the document. So if you are using <meta charset="utf-8"> or HTTP header "Content-Type: text/html; charset=utf-8" in your document, then any script file that is referenced in the document should also be saved in UTF-8 format.

Generally speaking you should always use UTF-8 for everything unless you have no choice but to use a single byte encoding such as Windows-1252 (ANSI).

If you change the top dropdown to 'All Files' and then just add.js to the end of your file name that should do it.

You can leave the character encoding as UTF-8

在此处输入图像描述

You can use any of them. ANSI encoding is just an extension of ASCII with an additional 128 characters. I do not think there will be any advantage to using one over another(in the context of javascript programming) but I may be wrong. Here is a comparison

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM