Languages
[Edit]
EN

HTML - set web page encoding (e.g. UTF-8)

3 points
Created by:
Wiktor-Sribiew
830

In this article, we would like to show you how to set encoding in HTML (e.g. UTF-8).

Quick solution (put it in the <head> element):

Warning:

In practice it is necessary to set encoding on the server side to avoid bugs.

We can achieve it in 2 ways:

  • by saving *.html files using proper encoding, e.g. UTF-8,
  • by adding specific header to the response, e.g. Content-Type: text/html;charset=UTF-8

 

Practical example

Edit

In this example, we present a simple full page template with the most commonly used charset - UTF-8.

Alternative solution

Edit

In this example, we present the second approach, which is usingcontent-type meta tag with charset set to utf-8.

 

References

Edit
  1. <meta>: The metadata element - HTML: HyperText Markup Language | MDN

Alternative titles

  1. HTML - cheracters set (e.g. UTF-8)
  2. HTML - charset attribute (e.g. UTF-8)
  3. HTML - how to set encoding (e.g. UTF-8)
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join