Character Sets and URL Encoding
What Is It?
UTF-8 lets your page show text from many languages. URL encoding keeps spaces and special characters safe inside an address.
What the Tags Mean
meta charset="UTF-8": declares the text encoding in the head.a href: holds a link address.%20: can represent a space in a URL value.
Example 1
Save each example as index.html and open it in your browser. Each code block is a complete page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Character Sets and URL Encoding</title>
</head>
<body>
<p>Hello · नमस्ते · こんにちは</p>
</body>
</html>Browser preview
What you see: The page shows greetings in three languages when your file uses UTF-8.
Example 2: Another Use
A link can include a search value. This example stays on your current page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Character Sets and URL Encoding</title>
</head>
<body>
<a href="?q=paper%20craft">Search for paper craft</a>
</body>
</html>Browser preview
Simple Tip
The link adds a query value. It does not create search results by itself.
Try It Yourself
Change paper%20craft to book%20repair.