Global UTF-encoding, the right way

Posted by mowgli on Pro Webmasters See other posts from Pro Webmasters or by mowgli
Published on 2014-06-12T13:48:28Z Indexed on 2014/06/12 15:41 UTC
Read the original article Hit count: 313

Filed under:
|
|
|

I'm curious, as to what is the right way to have UTF-8 encoding on all web files

All my files (incl. CSS and JS) are made and saved in UTF-8 encoding

In PHP, I set the char-set on top of the main page (this page includes all others) with:

header('Content-type: text/html; charset=utf-8');

In the same page I have this html meta tag:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Then I stubled upon an external css file that has this on first line:

@charset "UTF-8";

And now I wonder, should I set the charset INSIDE all my CSS/JS files too, like that?

And/or should I serve each file with charset=utf-8 in the meta tag?

© Pro Webmasters or respective owner

Related posts about css

Related posts about JavaScript