Open In App
Related Articles

How to specify the character encoding used in an external script file in HTML5 ?

Improve Article
Improve
Save Article
Save
Like Article
Like

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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 17 Mar, 2021
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials