Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website HTML First Build Structure

whats the point of the meta tag i dont understand it?

<meta charset="utf-8"> what is the use of this code, do i need it in all websites i build?

2 Answers

adrianeinnis
adrianeinnis
3,782 Points

UTF-8 encoding is probably the most often used one in the western world. It's capable of displaying many languages accurately, that wouldn't show up properly in your html if you would remove this meta tag.

Example: in german words like "Tschüss!" (bye!) or "Gruß" (greating) the letters 'ü' and 'ß' won't be displayed, if you don't include the utf-8 meta tag. You can try it out!

There are other encoding methods, many of which are outdated, have security vulnerabilities, don't work as seamless when using multiple languages in html, or are just not as "slim" as utf-8. It also works very well across different browsers.

When browsing east asian websites for example, like korean websites, one can still encounter a lot of websites that use encoding that won't be displayed in different browsers, as they often favor IE, and can require quite some research ;-P

You might have a look at the W3C information pages on this topic: https://www.w3.org/International/questions/qa-choosing-encodings.en

happy learning & coding!

Kerryn Smith
Kerryn Smith
1,228 Points

Cheers, this was very good at explaining something I also didn't quite understand...

got it thank you :D

Alexander Melo
Alexander Melo
4,297 Points

The charset attribute specifies the character encoding for the HTML document

thanks