2
I have the following Javascript function that issues a confirm
with a message containing 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. "You want to unsubscribe and return to initial gina?".
I put the unescape
to try to correct that mistake, but it was not effective.
I inform you that in the HTML page I have already defined the charset
for utf-8
and to ISO
, but it didn’t solve the problem either.
Follows the 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 types of charset.
Anyway, set the page charset by php using the line of code <?php header('Content-Type: text/html; charset=UTF-8'); ?>
and also saved the page as HTML without GOOD, but the problem has not been solved.
Possible duplicate of Doubt with charset=iso-8859-1 and utf8
– Woss
Amigo the answer https://answall.com/a/43205/3635 explains exactly that it is impossible to use 2 Charsets, in fact the answer teaches how to configure a specific single charset, you should not only save the page with "UT8 without BOM", but the files
.js
also must be saved with "UTF8 without good". Read the answer calmly and will understand, it is a guide to how to do.– Guilherme Nascimento
Guilherme, I saved all files . js in UTF8 without BOM, but it remains the same. I ask you to check the comment I made in Matthew Callixtus' reply. Maybe the information I put in this comment will help identify the problem.
– Hugo Guitti
In the reply and not in the comment I said that the problem is only to save the . php and . js as UTF-8, I said this is one of the details, have to follow the step by step and do all, It may be that with a header of life already solve, but you will run the results in a different location and in fact you will cause an unimaginable side effect, the best possible is to review all points, header, html, mysql charset, save documents with utf8 including those like include and etc. The answer explains this well. It is not pq a header worked first that you are guaranteed ;)
– Guilherme Nascimento
Another thing, you have to see if in fact you want to use UTF-8 or iso-8859-1 and so adjust as desired, if it is iso-8859-1 (or latin1 in the bank) then just exchange utf-8 for iso-8859-1 and save the documents as ANSI, of course set the header. The answer there only used the example utf-8, does not mean that you are required to use UTF-8 ;)
– Guilherme Nascimento