HTML Script charset attribute


Define the character encoding used in a linked script file:
<script type="text/javascript" src="myscripts.js" charset="UTF-8"></script>

Definition and Usage

The charset attribute specifies the character encoding used in an external script file (referred to by the src attribute).
The charset attribute is used when the character encoding in an external script file differs from the encoding in the main file.
The default character encoding is ISO-8859-1.

Browser Support

The charset attribute is supported in all major browsers.


<script charset="value">

Attribute Values

Value Description
character_encoding The character encoding of an external script file. Some common values:
  • "ISO-8859-1" - Standard encoding for the Latin alphabet
  • "UTF-8" - Character encoding for Unicode. Compatible with ASCII
HTML Script charset attribute Reviewed by 1000sourcecodes on 21:02 Rating: 5
Powered by Blogger.