2
I’m having trouble printing the characters correctly.
if I write anything inside the html, the characters are normal.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
if I write a text with special characters in javascript and have it printed in a textarea: "Referral", this ends up returning in the textarea
Indicação
document.getElementById('textarea').value = "Indicação";
You have some way of printing that, right? the only way to print "right" is by doing what the guy on this blog said? http://marcelomaidden.blogspot.com.br/2012/11/como-colocar-acentuacao-em-alerts.html
Javascript is in an external file?
– Rafael Almeida
<script type="text/javascript" src="js/teste.js" charset="ISO-8859-1"></script>
yes. I tried to do something like, but I couldn’t.– João
@João on the Meta tag you put UTF-8, and in the javascript example you put ISO-8859-1, I don’t know much about Charsets, but it shouldn’t be the same?
– Marciano.Andrade
did not work if I put the same values.
– João
See if the Javascript file is encoded as ISO-8859-1. This already happened to me, the PHP scripts had the accents broken because the HTML was in UTF-8 and the scripts in ISO-8859-1 (even with the header pointing UTF-8). To convert the files you can use Notepad++ or any other text editor. In Notepad++: Menu > Encoding >
Enconde in UTF-8 without BOM
– Rafael Almeida