Different escape codes for the same keyboard keys — where did they come from?What is the prototype of the...

What is the meaning of "usr"?

Is there any danger of my neighbor having my wife's signature?

Crack the bank account's password!

Will the duration of traveling to Ceres using the same tech developed for going to Mars be proportional to the distance to go to Mars or not?

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Does Plato's "Ring of Gyges" have a corrupting influence on its wearer?

Is it possible to narrate a novel in a faux-historical style without alienating the reader?

How can I handle players killing my NPC outside of combat?

Why don't you get burned by the wood benches in a sauna?

Coworker is trying to get me to sign his petition to run for office. How to decline politely?

Sets that are both Sum-free and Product-free

How do I purchase a drop bar bike that will be converted to flat bar?

How to regain lost focus?

Why does a single AND gate need 60 transistors?

Is layered encryption more secure than long passwords?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

What is an explicit bijection in combinatorics?

Is it possible to methodically find the total of ways to read a given phrase making a stack?

Is Screenshot Time-tracking Common?

In the Lost in Space intro why was Dr. Smith actor listed as a special guest star?

Is the UK legally prevented from having another referendum on Brexit?

What is wrong with my use of "find -print0"?

Is there a way to pause a running process on Linux systems and resume later?



Different escape codes for the same keyboard keys — where did they come from?


What is the prototype of the Eastern Bloc videoterminal Videoton 340?What trial-and-error method to use for determining serial terminal settings (RAC2-8-EK)Can escape sequences be entered directly from keyboard to terminal for VT100 and similar?What happens when a terminal (like a VT100) is connected to a computer?What was the largest resolution supported by terminal escape codes?













2















While debugging uart on some microcontroller board, I've made a simple firmware that simply responds on every byte received dumping that byte in HEX like "0x**". Then, using different terminal emulators in linux, I've found that there are many different escape encodings for the following keyboard keys:



for F1..F5:




  • "33[["+'A'..'E' in linux text console

  • "33O"+'P','Q','R','S' (for F1..F4 only) in different gui terminals like mate-terminal and xterm, also running from screen or tmux

  • "33[11~".."33[15~" in putty (run in windows XP)

  • "33[15~" for F5 only in different gui terminals (mate-terminal, xterm), also in screen or tmux

  • "33[16~" for F5 when using minicom in linux (that seems to recode "33[[E" and "33[15~" into that sequence)


for BACKSPACE:




  • 0x08 or 0x7F


for HOME/END:




  • "33[1~", "33[4~" in text console, putty and running from screen or tmux

  • "33O"+'H','F' in mate-terminal

  • "33[H","33[F" in xterm

  • "33[1~", "33O"+'F' recoded by minicom from gui terminals


When not explicitly noted, I was using either picocom or socat to interact with /dev/ttyUSB0. Those tools seem not to recode any codes generated by terminal emulator, unlike the minicom.



So the questions are:




  • What historic computer systems are inherited in every listed encoding for that keyboard keys?

  • What are the historic reasons (if any) for the minicom to change F5 code as well as recode HOME/END?










share|improve this question


















  • 2





    The short answer is, for the most part the varied encodings are simply due to the lack of an available standard, so each manufacturer came up with their own. Eventually the ANSI standard was defined but by then there were already many systems already in place using the older encodings.

    – Ken Gober
    1 hour ago






  • 2





    The difference between backspace (0x08) and delete (0x7f) is a special case; they originally meant different things. Backspace was a typewriter/printer carriage control character and moved the printhead one space to the left, which was useful if you wanted to overprint one character on top of another. Delete was used to 'overpunch' a character on paper tape and the convention was to ignore them when reading a tape, this was a convenient way to 'rub out' a typo on a paper tape without having to throw away the whole tape and start over (which is why 0x7f is also known as 'rubout').

    – Ken Gober
    1 hour ago
















2















While debugging uart on some microcontroller board, I've made a simple firmware that simply responds on every byte received dumping that byte in HEX like "0x**". Then, using different terminal emulators in linux, I've found that there are many different escape encodings for the following keyboard keys:



for F1..F5:




  • "33[["+'A'..'E' in linux text console

  • "33O"+'P','Q','R','S' (for F1..F4 only) in different gui terminals like mate-terminal and xterm, also running from screen or tmux

  • "33[11~".."33[15~" in putty (run in windows XP)

  • "33[15~" for F5 only in different gui terminals (mate-terminal, xterm), also in screen or tmux

  • "33[16~" for F5 when using minicom in linux (that seems to recode "33[[E" and "33[15~" into that sequence)


for BACKSPACE:




  • 0x08 or 0x7F


for HOME/END:




  • "33[1~", "33[4~" in text console, putty and running from screen or tmux

  • "33O"+'H','F' in mate-terminal

  • "33[H","33[F" in xterm

  • "33[1~", "33O"+'F' recoded by minicom from gui terminals


When not explicitly noted, I was using either picocom or socat to interact with /dev/ttyUSB0. Those tools seem not to recode any codes generated by terminal emulator, unlike the minicom.



So the questions are:




  • What historic computer systems are inherited in every listed encoding for that keyboard keys?

  • What are the historic reasons (if any) for the minicom to change F5 code as well as recode HOME/END?










share|improve this question


















  • 2





    The short answer is, for the most part the varied encodings are simply due to the lack of an available standard, so each manufacturer came up with their own. Eventually the ANSI standard was defined but by then there were already many systems already in place using the older encodings.

    – Ken Gober
    1 hour ago






  • 2





    The difference between backspace (0x08) and delete (0x7f) is a special case; they originally meant different things. Backspace was a typewriter/printer carriage control character and moved the printhead one space to the left, which was useful if you wanted to overprint one character on top of another. Delete was used to 'overpunch' a character on paper tape and the convention was to ignore them when reading a tape, this was a convenient way to 'rub out' a typo on a paper tape without having to throw away the whole tape and start over (which is why 0x7f is also known as 'rubout').

    – Ken Gober
    1 hour ago














2












2








2








While debugging uart on some microcontroller board, I've made a simple firmware that simply responds on every byte received dumping that byte in HEX like "0x**". Then, using different terminal emulators in linux, I've found that there are many different escape encodings for the following keyboard keys:



for F1..F5:




  • "33[["+'A'..'E' in linux text console

  • "33O"+'P','Q','R','S' (for F1..F4 only) in different gui terminals like mate-terminal and xterm, also running from screen or tmux

  • "33[11~".."33[15~" in putty (run in windows XP)

  • "33[15~" for F5 only in different gui terminals (mate-terminal, xterm), also in screen or tmux

  • "33[16~" for F5 when using minicom in linux (that seems to recode "33[[E" and "33[15~" into that sequence)


for BACKSPACE:




  • 0x08 or 0x7F


for HOME/END:




  • "33[1~", "33[4~" in text console, putty and running from screen or tmux

  • "33O"+'H','F' in mate-terminal

  • "33[H","33[F" in xterm

  • "33[1~", "33O"+'F' recoded by minicom from gui terminals


When not explicitly noted, I was using either picocom or socat to interact with /dev/ttyUSB0. Those tools seem not to recode any codes generated by terminal emulator, unlike the minicom.



So the questions are:




  • What historic computer systems are inherited in every listed encoding for that keyboard keys?

  • What are the historic reasons (if any) for the minicom to change F5 code as well as recode HOME/END?










share|improve this question














While debugging uart on some microcontroller board, I've made a simple firmware that simply responds on every byte received dumping that byte in HEX like "0x**". Then, using different terminal emulators in linux, I've found that there are many different escape encodings for the following keyboard keys:



for F1..F5:




  • "33[["+'A'..'E' in linux text console

  • "33O"+'P','Q','R','S' (for F1..F4 only) in different gui terminals like mate-terminal and xterm, also running from screen or tmux

  • "33[11~".."33[15~" in putty (run in windows XP)

  • "33[15~" for F5 only in different gui terminals (mate-terminal, xterm), also in screen or tmux

  • "33[16~" for F5 when using minicom in linux (that seems to recode "33[[E" and "33[15~" into that sequence)


for BACKSPACE:




  • 0x08 or 0x7F


for HOME/END:




  • "33[1~", "33[4~" in text console, putty and running from screen or tmux

  • "33O"+'H','F' in mate-terminal

  • "33[H","33[F" in xterm

  • "33[1~", "33O"+'F' recoded by minicom from gui terminals


When not explicitly noted, I was using either picocom or socat to interact with /dev/ttyUSB0. Those tools seem not to recode any codes generated by terminal emulator, unlike the minicom.



So the questions are:




  • What historic computer systems are inherited in every listed encoding for that keyboard keys?

  • What are the historic reasons (if any) for the minicom to change F5 code as well as recode HOME/END?







terminal escape-codes






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 9 hours ago









lvdlvd

2,718619




2,718619








  • 2





    The short answer is, for the most part the varied encodings are simply due to the lack of an available standard, so each manufacturer came up with their own. Eventually the ANSI standard was defined but by then there were already many systems already in place using the older encodings.

    – Ken Gober
    1 hour ago






  • 2





    The difference between backspace (0x08) and delete (0x7f) is a special case; they originally meant different things. Backspace was a typewriter/printer carriage control character and moved the printhead one space to the left, which was useful if you wanted to overprint one character on top of another. Delete was used to 'overpunch' a character on paper tape and the convention was to ignore them when reading a tape, this was a convenient way to 'rub out' a typo on a paper tape without having to throw away the whole tape and start over (which is why 0x7f is also known as 'rubout').

    – Ken Gober
    1 hour ago














  • 2





    The short answer is, for the most part the varied encodings are simply due to the lack of an available standard, so each manufacturer came up with their own. Eventually the ANSI standard was defined but by then there were already many systems already in place using the older encodings.

    – Ken Gober
    1 hour ago






  • 2





    The difference between backspace (0x08) and delete (0x7f) is a special case; they originally meant different things. Backspace was a typewriter/printer carriage control character and moved the printhead one space to the left, which was useful if you wanted to overprint one character on top of another. Delete was used to 'overpunch' a character on paper tape and the convention was to ignore them when reading a tape, this was a convenient way to 'rub out' a typo on a paper tape without having to throw away the whole tape and start over (which is why 0x7f is also known as 'rubout').

    – Ken Gober
    1 hour ago








2




2





The short answer is, for the most part the varied encodings are simply due to the lack of an available standard, so each manufacturer came up with their own. Eventually the ANSI standard was defined but by then there were already many systems already in place using the older encodings.

– Ken Gober
1 hour ago





The short answer is, for the most part the varied encodings are simply due to the lack of an available standard, so each manufacturer came up with their own. Eventually the ANSI standard was defined but by then there were already many systems already in place using the older encodings.

– Ken Gober
1 hour ago




2




2





The difference between backspace (0x08) and delete (0x7f) is a special case; they originally meant different things. Backspace was a typewriter/printer carriage control character and moved the printhead one space to the left, which was useful if you wanted to overprint one character on top of another. Delete was used to 'overpunch' a character on paper tape and the convention was to ignore them when reading a tape, this was a convenient way to 'rub out' a typo on a paper tape without having to throw away the whole tape and start over (which is why 0x7f is also known as 'rubout').

– Ken Gober
1 hour ago





The difference between backspace (0x08) and delete (0x7f) is a special case; they originally meant different things. Backspace was a typewriter/printer carriage control character and moved the printhead one space to the left, which was useful if you wanted to overprint one character on top of another. Delete was used to 'overpunch' a character on paper tape and the convention was to ignore them when reading a tape, this was a convenient way to 'rub out' a typo on a paper tape without having to throw away the whole tape and start over (which is why 0x7f is also known as 'rubout').

– Ken Gober
1 hour ago










2 Answers
2






active

oldest

votes


















4














Partial answer:



General notes: ESC [ is "control sequence introducer", CSI. ESC O is "single-shift-3", SS3.



DEC VT200 terminals sent CSI n~ for function keys F6 onwards, where n = the F-key number plus 11 decimal. F1 to F5 were local only, but it is a reasonable extension to have them send similar sequences with n = 12 to 16. n = 11 to 15 seems like an off-by-one error from this viewpoint.



DEC VT100 terminals sent SS3 P,Q,R,S for four keys labelled PF1 to PF4 on the numeric keypad. Probably VT200 too.



DEC VT100s used CSI 1 to 4 ~ for the so-called editing keypad.



For PC-connected keyboards, of course, the keyboard sends scan codes that are mapped to character sequences by software, so there's plenty of room for latitude here. It is not necessarily true that the PC software was emulating any actual terminal; it just required that the key-mapping software provided something that was potentially useful to application code.



Backspace/delete was a common confusion on terminals of the day. Sometimes a <x]key sent backspace, sometimes it sent delete. Software tended to declare one of those to be the appropriate character-delete operation.



The summary, then, is that many of these came in principle from DEC keyboards, but PC keyboards don't necessarily have the same key layouts, so the terminal emulators do a best-effort (and subjective) job of mapping the keys they need onto the keys they've got.






share|improve this answer
























  • I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

    – lvd
    3 hours ago






  • 1





    My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

    – another-dave
    2 hours ago





















1














True terminals used to vary a lot in the code sequences they accepted for their control and code sequences they returned when a key was pressed. And keyboards were less standardized than nowadays, so the keys available used also to vary a lot.



Programs and libraries (the best known is probably curses) which had to interact with several kinds of terminals used a database giving that information. The database is still available here if you really want to find out the origin of the code sequences used by today's terminal emulators.



I won't do that research but just add that they tend to emulate the sequence of popular DEC VTxx series (whose structure has been standardized as ECMA-48 -- there is an equivalent ISO standard, ISO/IEC 6429, but the ECMA one has the advantage of being available for free on the web; one sometimes use "ANSI sequences" either to refer to the ECMA-48 one, or as a more generic way to refer to control sequences), but different models in the series sometimes used different sequences. Terminal emulator also sometimes code sequences having no historical sources for features having little historical precedent.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "648"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f9251%2fdifferent-escape-codes-for-the-same-keyboard-keys-where-did-they-come-from%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    Partial answer:



    General notes: ESC [ is "control sequence introducer", CSI. ESC O is "single-shift-3", SS3.



    DEC VT200 terminals sent CSI n~ for function keys F6 onwards, where n = the F-key number plus 11 decimal. F1 to F5 were local only, but it is a reasonable extension to have them send similar sequences with n = 12 to 16. n = 11 to 15 seems like an off-by-one error from this viewpoint.



    DEC VT100 terminals sent SS3 P,Q,R,S for four keys labelled PF1 to PF4 on the numeric keypad. Probably VT200 too.



    DEC VT100s used CSI 1 to 4 ~ for the so-called editing keypad.



    For PC-connected keyboards, of course, the keyboard sends scan codes that are mapped to character sequences by software, so there's plenty of room for latitude here. It is not necessarily true that the PC software was emulating any actual terminal; it just required that the key-mapping software provided something that was potentially useful to application code.



    Backspace/delete was a common confusion on terminals of the day. Sometimes a <x]key sent backspace, sometimes it sent delete. Software tended to declare one of those to be the appropriate character-delete operation.



    The summary, then, is that many of these came in principle from DEC keyboards, but PC keyboards don't necessarily have the same key layouts, so the terminal emulators do a best-effort (and subjective) job of mapping the keys they need onto the keys they've got.






    share|improve this answer
























    • I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

      – lvd
      3 hours ago






    • 1





      My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

      – another-dave
      2 hours ago


















    4














    Partial answer:



    General notes: ESC [ is "control sequence introducer", CSI. ESC O is "single-shift-3", SS3.



    DEC VT200 terminals sent CSI n~ for function keys F6 onwards, where n = the F-key number plus 11 decimal. F1 to F5 were local only, but it is a reasonable extension to have them send similar sequences with n = 12 to 16. n = 11 to 15 seems like an off-by-one error from this viewpoint.



    DEC VT100 terminals sent SS3 P,Q,R,S for four keys labelled PF1 to PF4 on the numeric keypad. Probably VT200 too.



    DEC VT100s used CSI 1 to 4 ~ for the so-called editing keypad.



    For PC-connected keyboards, of course, the keyboard sends scan codes that are mapped to character sequences by software, so there's plenty of room for latitude here. It is not necessarily true that the PC software was emulating any actual terminal; it just required that the key-mapping software provided something that was potentially useful to application code.



    Backspace/delete was a common confusion on terminals of the day. Sometimes a <x]key sent backspace, sometimes it sent delete. Software tended to declare one of those to be the appropriate character-delete operation.



    The summary, then, is that many of these came in principle from DEC keyboards, but PC keyboards don't necessarily have the same key layouts, so the terminal emulators do a best-effort (and subjective) job of mapping the keys they need onto the keys they've got.






    share|improve this answer
























    • I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

      – lvd
      3 hours ago






    • 1





      My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

      – another-dave
      2 hours ago
















    4












    4








    4







    Partial answer:



    General notes: ESC [ is "control sequence introducer", CSI. ESC O is "single-shift-3", SS3.



    DEC VT200 terminals sent CSI n~ for function keys F6 onwards, where n = the F-key number plus 11 decimal. F1 to F5 were local only, but it is a reasonable extension to have them send similar sequences with n = 12 to 16. n = 11 to 15 seems like an off-by-one error from this viewpoint.



    DEC VT100 terminals sent SS3 P,Q,R,S for four keys labelled PF1 to PF4 on the numeric keypad. Probably VT200 too.



    DEC VT100s used CSI 1 to 4 ~ for the so-called editing keypad.



    For PC-connected keyboards, of course, the keyboard sends scan codes that are mapped to character sequences by software, so there's plenty of room for latitude here. It is not necessarily true that the PC software was emulating any actual terminal; it just required that the key-mapping software provided something that was potentially useful to application code.



    Backspace/delete was a common confusion on terminals of the day. Sometimes a <x]key sent backspace, sometimes it sent delete. Software tended to declare one of those to be the appropriate character-delete operation.



    The summary, then, is that many of these came in principle from DEC keyboards, but PC keyboards don't necessarily have the same key layouts, so the terminal emulators do a best-effort (and subjective) job of mapping the keys they need onto the keys they've got.






    share|improve this answer













    Partial answer:



    General notes: ESC [ is "control sequence introducer", CSI. ESC O is "single-shift-3", SS3.



    DEC VT200 terminals sent CSI n~ for function keys F6 onwards, where n = the F-key number plus 11 decimal. F1 to F5 were local only, but it is a reasonable extension to have them send similar sequences with n = 12 to 16. n = 11 to 15 seems like an off-by-one error from this viewpoint.



    DEC VT100 terminals sent SS3 P,Q,R,S for four keys labelled PF1 to PF4 on the numeric keypad. Probably VT200 too.



    DEC VT100s used CSI 1 to 4 ~ for the so-called editing keypad.



    For PC-connected keyboards, of course, the keyboard sends scan codes that are mapped to character sequences by software, so there's plenty of room for latitude here. It is not necessarily true that the PC software was emulating any actual terminal; it just required that the key-mapping software provided something that was potentially useful to application code.



    Backspace/delete was a common confusion on terminals of the day. Sometimes a <x]key sent backspace, sometimes it sent delete. Software tended to declare one of those to be the appropriate character-delete operation.



    The summary, then, is that many of these came in principle from DEC keyboards, but PC keyboards don't necessarily have the same key layouts, so the terminal emulators do a best-effort (and subjective) job of mapping the keys they need onto the keys they've got.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 4 hours ago









    another-daveanother-dave

    1,027110




    1,027110













    • I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

      – lvd
      3 hours ago






    • 1





      My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

      – another-dave
      2 hours ago





















    • I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

      – lvd
      3 hours ago






    • 1





      My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

      – another-dave
      2 hours ago



















    I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

    – lvd
    3 hours ago





    I would like to point that it has actually nothing to do with PC keyboards, since in the OS like windows or linux internal representation (scancodes given to the processes which would like to receive events or keyboard state matrix) has nothing to do with what actual keyboard send, be it either PS/2 keyboard, USB keyboard or some custom key matrix that is represented as keyboard by some driver.

    – lvd
    3 hours ago




    1




    1





    My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

    – another-dave
    2 hours ago







    My point was that a 'terminal' sends characters in some character code (in the VT2xx case, per DEC std 169, a superset of ASCII) whereas a 'PC keyboard' sends codes which must be translated into characters. True, I represented it as a two-stage procedure, whereas it's likely three stage: scan-codes to virtual keycodes to characters, the first in the OS, the second in the terminal emulator.

    – another-dave
    2 hours ago













    1














    True terminals used to vary a lot in the code sequences they accepted for their control and code sequences they returned when a key was pressed. And keyboards were less standardized than nowadays, so the keys available used also to vary a lot.



    Programs and libraries (the best known is probably curses) which had to interact with several kinds of terminals used a database giving that information. The database is still available here if you really want to find out the origin of the code sequences used by today's terminal emulators.



    I won't do that research but just add that they tend to emulate the sequence of popular DEC VTxx series (whose structure has been standardized as ECMA-48 -- there is an equivalent ISO standard, ISO/IEC 6429, but the ECMA one has the advantage of being available for free on the web; one sometimes use "ANSI sequences" either to refer to the ECMA-48 one, or as a more generic way to refer to control sequences), but different models in the series sometimes used different sequences. Terminal emulator also sometimes code sequences having no historical sources for features having little historical precedent.






    share|improve this answer






























      1














      True terminals used to vary a lot in the code sequences they accepted for their control and code sequences they returned when a key was pressed. And keyboards were less standardized than nowadays, so the keys available used also to vary a lot.



      Programs and libraries (the best known is probably curses) which had to interact with several kinds of terminals used a database giving that information. The database is still available here if you really want to find out the origin of the code sequences used by today's terminal emulators.



      I won't do that research but just add that they tend to emulate the sequence of popular DEC VTxx series (whose structure has been standardized as ECMA-48 -- there is an equivalent ISO standard, ISO/IEC 6429, but the ECMA one has the advantage of being available for free on the web; one sometimes use "ANSI sequences" either to refer to the ECMA-48 one, or as a more generic way to refer to control sequences), but different models in the series sometimes used different sequences. Terminal emulator also sometimes code sequences having no historical sources for features having little historical precedent.






      share|improve this answer




























        1












        1








        1







        True terminals used to vary a lot in the code sequences they accepted for their control and code sequences they returned when a key was pressed. And keyboards were less standardized than nowadays, so the keys available used also to vary a lot.



        Programs and libraries (the best known is probably curses) which had to interact with several kinds of terminals used a database giving that information. The database is still available here if you really want to find out the origin of the code sequences used by today's terminal emulators.



        I won't do that research but just add that they tend to emulate the sequence of popular DEC VTxx series (whose structure has been standardized as ECMA-48 -- there is an equivalent ISO standard, ISO/IEC 6429, but the ECMA one has the advantage of being available for free on the web; one sometimes use "ANSI sequences" either to refer to the ECMA-48 one, or as a more generic way to refer to control sequences), but different models in the series sometimes used different sequences. Terminal emulator also sometimes code sequences having no historical sources for features having little historical precedent.






        share|improve this answer















        True terminals used to vary a lot in the code sequences they accepted for their control and code sequences they returned when a key was pressed. And keyboards were less standardized than nowadays, so the keys available used also to vary a lot.



        Programs and libraries (the best known is probably curses) which had to interact with several kinds of terminals used a database giving that information. The database is still available here if you really want to find out the origin of the code sequences used by today's terminal emulators.



        I won't do that research but just add that they tend to emulate the sequence of popular DEC VTxx series (whose structure has been standardized as ECMA-48 -- there is an equivalent ISO standard, ISO/IEC 6429, but the ECMA one has the advantage of being available for free on the web; one sometimes use "ANSI sequences" either to refer to the ECMA-48 one, or as a more generic way to refer to control sequences), but different models in the series sometimes used different sequences. Terminal emulator also sometimes code sequences having no historical sources for features having little historical precedent.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 hours ago

























        answered 2 hours ago









        AProgrammerAProgrammer

        25114




        25114






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Retrocomputing Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f9251%2fdifferent-escape-codes-for-the-same-keyboard-keys-where-did-they-come-from%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

            Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

            How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...