I have the following JavaScript function that issues a confirm
with a message that contains special characters.
function cancelaCadastro(){
var cancelaCadastro = confirm(unescape("Você deseja cancelar o cadastro e voltar à página inicial?"));
if (cancelaCadastro == true){
location.href= "index.php";
} else{
return false;
}
}
The problem is that the message is being displayed as follows. "Do you want to cancel the registration and return to the homepage?".
I put unescape
to try to fix this error, but it was not effective.
I would like to inform you that in the HTML page I already set charset
to utf-8
and ISO
, but it also did not solve the problem.
Here is an example of meta-charset
:
<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8">
NOTE: This question is not a duplicate of the question Doubt with charset = iso-8859-1 and utf8 , because the problem is not related to using 2 different charset types.
Anyway, I set the charset of the page by php using the line of code <?php header('Content-Type: text/html; charset=UTF-8'); ?>
and also saved the page as HTML without BOM, but the problem was not solved.