Hack Forums
charset attribute - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: charset attribute (/showthread.php?tid=4400508)



charset attribute - clark.dll - Aug 17, 2014

What exactly does the following mean:
Quote:Specify the character encoding for the HTML document:


That's apparently what the charset attribute does, but I'm not entirely sure what that means and how it affects the document. Could anyone explain it to me?

Thanks


* - theAbsolute - Aug 17, 2014

Add this to your html page:

Code
ћирилица

Save it without encoding, and preview it in the browser. Then add encoding and see the difference.

Simply, without encoding you will get some strange symbols, and when you add UTF-8 encoding for example, you would be able to see this cyrillic letters without problems.


* - clark.dll - Aug 17, 2014

(Aug 17, 2014 11:06 AM)theAbsolute Wrote:  Add this to your html page:

Code
ћирилица

Save it without encoding, and preview it in the browser. Then add encoding and see the difference.

Simply, without encoding you will get some strange symbols, and when you add UTF-8 encoding for example, you would be able to see this cyrillic letters without problems.

Oh okay, thanks. I still don't understand why we'd need to add that assuming our web pages weren't written in any strange language.


* - theAbsolute - Aug 17, 2014

I can't be exact, but there are also some symbols, beside other letters. Probably, you don't have a need to put it if you are running some simple website.

But imagine if you have any kind of user system, or user comments, then you can always expect other letters then latin.
It can be contained in users names (notice strange nicknames on HF for example) user messages, etc.


* - clark.dll - Aug 18, 2014

Oh that makes sense, alright so it basically helps with other languages too right? In other words, it allows people to post in different languages without doing anything funky?


* - theAbsolute - Aug 18, 2014

Yes, we can say so. Simply, it allows posting content on our websites in letters that isn't just latin.


* - clark.dll - Aug 18, 2014

(Aug 18, 2014 01:46 PM)theAbsolute Wrote:  Yes, we can say so. Simply, it allows posting content on our websites in letters that isn't just latin.

Thanks for your help.

+3 and closing.