Simplified the code for the alert() function.

  Tested it with UTF-8 string too.