Jump to Real's How-to Main page

Print special character like copyright sign

  • Use the escape "&#" and the character number (in decimal) with ";".
  • Use the escape character "\" with the octal code. The following program prints all available characters with their decimal/octal codes
    <SCRIPT>
    document.write("There is no &#169; on this tip");
    document.write(" and no &#174; or &#153; too <br>");
    for (i=33; i<256; i++) {
      document.write
        ("&#"+i+"     dec =" + i +"   oct =" + (i).toString(8) );
      document.write("<br>");
      }
    </SCRIPT>
    
    To show in an alert box with accented characters, use something like this :
    alert("\350 \351 \352 \353");


    If you find this article useful, consider making a small donation
    to show your support for this Web site and its content.

    Written and compiled by Réal Gagnon ©1998-2008
    [ home ]