JS: Source Code Encoding

By Xah Lee. Date: . Last updated: .

JavaScript source code's charset is Unicode.

JavaScript spec does not specify a default encoding for source code file.

ECMAScript® 2016 Language Specification#sec-ecmascript-language-source-code

It means, JavaScript source code can contain any character of Unicode. For example, including any Chinese character, or Egyptian Hieroglyph, or emoji.

For JavaScript file encoding, you should save JavaScript file in UTF-8 encoding. UTF-8 is the standard encoding for much of web technologies.

[see Unicode Basics: Character Set, Encoding, UTF-8]

[see HTML: Character Sets and Encoding]

JS String

  1. String Overview
  2. Template String
  3. Char, Code Unit, Codepoint
  4. String Escape Sequence
  5. Unicode Escape Sequence

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Object Ref
  5. DOM Scripting
  6. SVG
  7. Blog