displaying non-ascii characters in a Javscript alert

This code:

alert ("Eine oder mehrere Ihrer Eingaben ist eine ungültige Zahl.");

ü is HTML for ü character (German). But when I put it in a Javascript alert, the browser actually displays ü instead of the character. If I put in ü then the browser displays garbage characters. How is the correct way to display a ü in an alert, if possible? Thank you!
Brad BansnerWeb DeveloperAsked:
Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
HTML Entities like ü is not converted by alert (javascript).
What is the charset of your page ?

The following work for me (not HTML entities) :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
alert("Eine oder mehrere Ihrer Eingaben ist eine ungültige Zahl.");

Open in new window

The functions in the following page may help if needed (for example if you received HTML entities from a third party) : http://www.wikistuce.info/doku.php/javascript/htmlentites_et_html_entity_decode_comme_en_php#%5B1%5D
Brad BansnerWeb DeveloperAuthor Commented:
I added your doctype and charset reference, now it works! Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.