Skip to content
Related Articles

Related Articles

How to specify the character encoding used in an external script file in HTML5 ?
  • Difficulty Level : Easy
  • Last Updated : 17 Mar, 2021

To specify the character encoding used in an external script file in HTML5 we use <script> charset attribute. The charset attribute specifies the character encoding for the HTML document when used by the <meta> element. The charset attribute specifies the character encoding used in an external script file when used by the <script> element.

Syntax:

<meta charset="">
<script charset="">

Attribute Values: Below are the values which specifies the character encoding for the external scripts.

  • ISO-8859-1: Used to specify the Standard encoding for the Latin alphabet.
  • UTF-8: Used to specify the Character encoding for Unicode.

Example: Below example illustrates the use of charset attribute using meta tag. 

HTML




<!DOCTYPE html>
<html>
  
<head>
  <meta charset="UTF-8">
</head>
  
<body>
  <h1>GeeksForGeeks</h1>
    
<p>Write some code....</p>
  
</body>
  
</html>

Output:

Meta Example

My Personal Notes arrow_drop_up
Recommended Articles
Page :