Francisco Presencia
Francisco Presencia

Reputation: 8858

Is ASCII 19 used?

I used a SO answer in my page for saving text on Ctrl+S, but as I don't like just copy-pasting without understanding first, I decided to do so first. It's a simple jQuery script, which I converted (still working) to this:

/* A key is pressed */
$(window).keypress(function(event) {
  /* Ctrl + S or ?? */
  if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {
    savedata();
    event.preventDefault();
    }
  });

The bit I'm asking about is event.which == 19. A quick search on ASCII codes tells me it's "Device Control 3 (oft. XOFF)". However, the link of XOFF and google didn't bring much light to the subject. So,

Is the ASCII character 19 (Device Control 3) still used in some computers/keyboards/other devices or can I securely delete that bit?

Note: I want to delete it so I can change it to a switch and I don't have any hanging, not understood code.

Upvotes: 1

Views: 1050

Answers (1)

kirilloid
kirilloid

Reputation: 14314

AFAIR which is key scancode, not an ASCII code. Anyway, code 19 should stand for some key like arrow or somewhat, which doesn't have printable representation like letter or digit. E.g. [Esc] has code 27.

http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes - looks correct.

Upvotes: 1

Related Questions