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 Use HTML Elements

Jackie Jen
Jackie Jen
2,723 Points

Remember to add a character set attribute for your meta tag

What does it mean add a character set attribute? Below is my code on setting meta tag

<!DOCTYPE html> <html> <head> <meta charset = "utf-8" > </head> <body> </body> </html>

4 Answers

Michael Alaev
Michael Alaev
5,415 Points

Try adding "meta tag" <meta> and set it to charset="UTF-8" like this: <meta charset="UTF-8">

Andrew Shook
Andrew Shook
31,709 Points

Good catch Michael. The charset does not get added to the html tag it should be put in a meta tag.

Andrew Shook
Andrew Shook
31,709 Points

You need to add the character set attribute to the <html> tag. The character set should be utf-8.

Jackie Jen
Jackie Jen
2,723 Points

Hi Andrew,

utf-8 is always using to represent every character in the Unicode character set. in What situation utf-16 or utf-32 is using?

Andrew Shook
Andrew Shook
31,709 Points

In HTML you would never really want to use anything other than utf-8. One reason is that you would need to change the HTTP response header send from your server to the clients browser. Since utf-16 is not ASCII compatible, the browser would translate the info you sent it into who only know what. So you would have to tell the browser in the response header, not a big deal but still an extra step. You would also have to set a BOM(btye order mark) to ensure proper translation.

Also, your website would not display correctly in older browsers, which wouldn't be to common but could still cause problems. You would also double the amount of data transferred from your server to the client's browser since all UTF-16 can use up to two bytes where are UTF-8 uses 1 byte.

Jackie Jen
Jackie Jen
2,723 Points

Thanks Andrew and Michael. Appreciate it..