views:

38

answers:

1

On the following line:

alert ( "Apenas os números 0, 1, 3, 5, 7 e 9 são permitidos." );

it prints like this:

Apenas os n?meros 0, 1, 3, 5, 7 e 9 s?o permitidos. 

The problem is that the characters ú and ã are not showing correctly.

In HTML I did something like:

Apenas os números 0, 1, 3, 5, 7 e 9 são permitidos. 

and it worked, but I don't know what to do in JavaScript. What should I do to solve this? If it has anything to do with the problem i'm using UTF-8.

Thanks and sorry about the English.

+1  A: 

Javascript always prints in UTF-16 no matter what the HTML is set to, try to find the hex decimal values of those characters.

Then show them like this:

\uXXXX

Where XXXX are the 2 hexavalues of the character.

For example:

alert("\u05D0");
Wolfy87
God, I love this site. Thank you very much.
StudioWorks
No problem, I just signed up, I quite like it too ^^
Wolfy87