UTF-8 is your friend – Part 3

This is the third and last part of the UTF-8 is your friend blog posts, which aims to help you integrate UTF-8 support in the server-side code (covered in part 1), in the database (covered in part 2) and finally in the browser output, which we will cover here.

Luckily, enabling UTF-8 output on the browser level, using HTML, is the easiest part. For this, we are going to use the META HTML tag that provides metadata information for the HTML document. Usually, metadata are used for the keywords or description of the page for search engine optimization purposes, but can also be used to define the character set to be used. As a matter of fact, the one and only single line displayed below is all what you need to add to your HTML files.

<metahttp-equiv="Content-Type"content="text/html; charset=UTF-8">

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

If you have followed the three parts of these blog posts, you shouldn’t have any problem using any language in your web application thanks to UTF-8. That’s why UTF-8 is your friend and it’s worth learning how to tame it.