HTML slt;script> charset property

HTML script charset property HTML and script.html

The charset property you need to use in an external file for character encoding, refer to the following example:

External JavaScript with a character set of UTF-8:

<script src="myscripts.js"charset="UTF-8"></script>

Try it out . . .

Browser support

HTML script charset property HTML script charset property HTML script charset property HTML script charset property HTML script charset property

The charset property is supported by all major browsers.


Definitions and usages

The charset property specifies the character encoding used in the external script file.

The charset property is used when the character encoding in the external script file is different from the encoding in the HTML document.

Tip: The charset property is used with the src property to tell the browser the character set to encode. Its value is the name of any ISO standard character set encoding.


Tips and comments

Note: The charset property applies only to external scripts (only when using the src property).


The difference between HTML 4.01 and HTML5

No.


Grammar

<script charset="charset">

The property value

value describe
charset Specify the character encoding of the external script file.

Some common values:

  • "ISO-8859-1" - Standard Coding of Latin Alphabet
  • "UTF-8" - Unicode character encoding.Compatible with ASCII

Please refer to our Character set reference manual , Get a complete character set list.



HTML script charset property HTML and script.html