Show special characters in javascript alert


Hello Friends,

Are you facing problem in showing special characters in javascript alert ? Are you facing problem in showing language special characters in javascript alert ? I was working in danish, french and other international language and validating form using javascript alert. When value is not entered by visitor in form and we show alert message than for some special character, it shows question mark message in javascript alert.

So for this type of problem you can write the Decimal numbers for the special characters and use the below function which convert the Decimal numbers into special characters and alert the message.

For Converting the special character into Decimal number, you can use the below link to find out appropriate decimal number of your language special character.


function deCode(str)
var convertstr;
convertstr = str.replace(/\&\#(\d+)\;/g, function(p1,p2){ return String.fromCharCode(p2) } );
return convertstr;

What you need to do is…
1) Copy above function and paste it in script tag.
2) Find the decimal character of your special character of language.(for e.g æ id for æ.)
3) Replace the decimal character in string which you write in alert().
4) Write alert string in deCode().
5) Thats it.

Let me know your thoughts for the same. If you face any problem in this than let me know via comment or contact us form.

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database and Open-source, enter your email address below. We will send you free tutorials.

Enter your email address:
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.

About Rakshit Patel
I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.

3 Comments on Show special characters in javascript alert

  • rajkumar
    February 20, 2012 at 10:37 am


  • carpet
    May 18, 2014 at 1:36 pm

    Hi,i read yokur blog from time to time and i own
    a similar one and i was just wondering if you get a lot of
    spam feedback? If so how do you reduce it, aany plugin or anything you can recommend?

    I get so much lately it’s driving me inssne so any help is very mmuch appreciated.

  • adult seo
    July 3, 2014 at 3:49 pm

    I don’t even know how I ended up here, but I thought this post was
    great. I don’t know who you are but certainly you’re going to a famous blogger if you are not
    already 😉 Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *




DHgate Computers - Computers, Cell Phones & more
  • We find everbuying built in php and use css to control the style.

About Author

PHP Freelancer

PHP Freelancer I am PHP Freelancer, Rakshit Patel working as PHP Programmer India. I am here to share all my developing knowledge with you people. For Hire PHP Developer India, contact me.
Follow on twitter: @raxit4u2

Get Free Programming Tutorials:

Become a Fan

Popular Topics

Recent Posts

Most Popular

Recent Comments

Get a Free Quote
Security Question: 3 + 8 = ?