DEV Community

Cover image for Content Encoding: why and how to use the meta charset tag and the Content-Type header

Content Encoding: why and how to use the meta charset tag and the Content-Type header

Boris Schapira on November 19, 2018

Improving the speed at which a web page is displayed often means making the browser’s life as easy as possible. When the browser receives an HTTP r...
Collapse
 
elmuerte profile image
Michiel Hendriks

Not just the web. UTF-8 should be the default everywhere. Make the base of your system UTF-8. On some cases you have no choice in which unicode encoding you use internally. For example, in Java UTF-16 is used for the internal String storage. But at least make all I/O UTF-8. Converting from and to unicode is almost trivial if your system operates in unicode. Trying to get unicode into a system which isn't, is a major issue to tackle (maybe even impossible).
Why UTF-8? because if it's just ASCII you only need 1 byte of storage. In a lot of cases in the western world, data is mostly ASCII.

Collapse
 
xowap profile image
Rémy 🤖

It's not that it should be the default. It's that anybody not using it should die in tremendous pain given the sheer stupidity of their actions. And the overall chaos and doubt they brought to this world.

Collapse
 
borisschapira profile image
Boris Schapira

Unicode All The Things!

Collapse
 
ben profile image
Ben Halpern

Great explanation of a not-always-well-understood topic which affects basically everyone at some point.