views:

1332

answers:

4

Does anybody know how i can show a euro or other html entity in javascript alert windows?

+1  A: 

An alert box can show any characters that are in the codepage for the currently logged on session. So for example if the machine is using the 1252 codepage you can display the eurosign.

Its not clear what your trouble is, you javascript string should not have the characters encoded as entities anyway?

Edit:

If you specify UTF-8 in the HTML or as the Response.CharSet but you haven't actually saved the ASP file in UTF-8 format you will have problems with characters outside of ASCII.

ASP assumes static parts of an ASP file are in the required codepage already and sends it verbatim byte for byte, no encoding will happen.

AnthonyWJones
that's true, it was my first thought, i'm using codepage 65001 in my asp classic page and utf-8 in my html, but still javascript would not show the euro sign correctly.
Sander Versluys
+10  A: 
alert('\u20AC');

HTML Entity Character Lookup

kkyy
+2  A: 
<script>alert("\u20ac");</script>

(20AC being the Unicode character for the euro sign.)

David James
A: 

Thanks so much...