Please see the code below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div>
¿Hola cómo está?
</div>
</body>
</html>
In this code, i want to print the characters properly as given in the file. 1 solution is to save the file in UTF-8 format. Is there any other way of doing it?
Saving the file as UTF-8 is insufficient. You should also signal the HTTP client (browser) that it’s a UTF-8 document.
This can be done in two ways:
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />into<head>element.To your original question, the encoding of the PHP file can be different – you’ll just have to re-encode the string from the local encoding to UTF-8 before you send it.