when using xTermJS, I am trying to use a UI to send commands, rather than just typing.. It's the project..
So, I sometimes need to send key combinations. Running on a Mac, I need to send "control+X" aka ^X
However, it doesn't seem like this is possible? At least not that anyone has published. IS it possible? I can use ASCII and hex characters to send, return, shift, arrow keys, etc. Can I do this "control" and/or "control+X" combination?
Ascii representations of decimal 0 through 31 are all escape codes representing combinations of the Ctrl key plus another character. The ascii characters used are taken from 4 rows below (add 64) on the ascii chart (decimal 64 through 94). For example
decimal 64 is ascii # => decimal 00 is ascii Ctrl + #
decimal 65 is ascii A => decimal 01 is ascii Ctrl + A
decimal 66 is ascii B => decimal 02 is ascii Ctrl + B
(some ASCII tables represent the Ctrl key with the carat '^' symbol as in ^# instead of Ctrl + #)
The chart image below shows the binary, octal, decimal, hexadecimal and escape codes/ascii representation for the first 128 values. As an online reference I recommend this ASCII Table (from the excellent reference website SS64.com). Or you can modify this spreadsheet and make your own ascii chart. This version has the original control code names once used by teletype machines.
Ok, just as I was posting this querstion, I found the answer.
I found it here: https://mw.lojban.org/papri/List_of_ASCII_letterals#ASCII_control_code_chart
under ASCII control code chart, under ^X which has the ASCII code of 18, which I send to xTermJs as \x18. This immediately solved my problem.
Seems like even these character combinations are defined as 1 ASCII character, and not 2 used together. In this case, my Control+X character is actually called a "Cancel" character.
Related
In the past, we've used ZPL to create Code39 barcodes with a TAB character encoded in the middle using something similar to the following:
*USERNAME$IPASSWORD*
The $I in the middle gets translated to a TAB by the barcode scanners we use.
Now we have a need to do the same thing, but using Code128. With Code39, all the text needs to be uppercase (unless you're using Code39Extended, which supports lowercase letters). Because some of the data that is going to be encoded will be lowercase, we need to use Code128 B for most of the barcode, switching to Code128 A in the middle to encode the TAB character, then back to Code128 B for the final part.
Looking through the "ZPL II Programming Guide", it should be as easy as:
>:username>7{TAB}>6PA55w0rd
The >: at the beginning sets the subset to B, the >7 changes the subset to A, and the >6 changes the subset back to B. The problem I'm having (and haven't found a solution after almost a week of searching) is: How do I encode a TAB character using only text?
Use the ^FH (field hexidecimal encoding) command immediately prior to your field data. Based on your example:
^FH_^FD>:username>7_09>6PA55w0rd^FS
Where the underscore '_' is used as the escape character and 09 is the hex value for tab.
Also note that if the chosen escape character appears in the user name or password, you will need to escape it as well.
I tried what Mark Warren suggested, but unfortunately, it didn't work. It did, however, get me looking back through the ZPL II Programming Guide and I found the following, which I had overlooked before:
Code 128, Subsets A and C are programmed in pairs of digits, 00 to 99, in the field data string.
...
In Subset A, each pair of digits results in a single character being encoded in the bar code...
So, since 73 equates to a TAB in Subset A, I tried the following:
>:username>773>6PA55w0rd
And it worked!
When testing my code that uses a routine that checks for chars to show using an ASCII value routine, my program should drop control chars but keep chars that may be entered by the user. It seems that while the ASCII value routine is called "ascii", it does not just return ascii values: giving it a char of ƒ returns 402.
For example have found this web site
but it doesn't have ƒ 402 that I can see.
Need to know whether there are other ascii codes above 402 that I need to test my code with. The character set used internally by the software that 'ascii' is written in uses UCS2. The web site found doesn't mention USC2.
There are probably many interpretations ouf »Control Character« out there, but I'll assume you mean C0 and C1 control characters (includes references to the relevant Unicode Standards).
The commonly used 32-bit integer representation of Unicode characters in general is the codepoint notation: »U+« followed by a at least 4 digit positive hex number, which you will find near mentions of characters, e.g. as in »U+007F (delete)«. The result of your »ASCII value« routine will probably be this number without the »U+«;
UCS-2 is a specific encoding for Unicode characters, which you probably won't need to care about directly), and is equivalent to Unicode codepoints for all characters within the the range of the BMP only.
Is there any way to type ASCII characters with more than 3 numbers using the numpad?
For example, if I hold Alt and type in 445 it prints out ¢.
How can I type in numbers like this: 195 128?
According to this table, it have to be À.
But if I type in 195 128, I get the number 8.
What's wrong?
Windows ALT key entry only supports the ANSI and OEM code pages of the localized version of Windows you are using.
For US Windows (xxx denotes a decimal value from 0-255):
ALT-0xxx = code page 1252 (link)
ALT-xxx = code page 437 (link)
So ALT-0253 should give ý and ALT-253 should give ².
The character you want (À) exists in cp1252 and is ALT-0192.
If you type a number >255, the character displayed is modulo 256. For ALT-445 you should get the same value as ALT-189. I do not get ¢ so you probably have a different localized version of Windows. Code page 850 is the Western European OEM code page and would generate the character for ALT-189. Try ALT-183 for À.
You need to type Alt+0192 for À.
Here is a useful link with correct alt codes: https://usefulshortcuts.com/alt-codes/accents-alt-codes.php
I believe I have a standard Win7 Pro setup. I know that when I hold down the alt key and type some digits I can get the extended Ascii character set, up to 255. But I've also noticed that when I type alt+larger numbers I get different code pages. In this text box I can type alt+ plus sign and then 0254 and I get what seems to be this Cryllic letter þ And alt plus +sign+ 0232 gets this: è (e with accent aigu) and so forth. Is there a list of how these alt + plus sign + 3 digits maps to what letter?
Looking at these characters in Notepad++ I see that they are generated by 0xC3 0xBE and 0xC3 and 0xA8. BUT if I type alt+195 (which is 0xC3 in Decimal) followed by 190 (0xBE) I get two different charcters (mapped to 190 and 195). How does the app know to combine the two? There is nothing in the raw data to show that?
I am writing some behavioural tests for code that interacts with a terminal and I need to assert behaviour on the sequence C-p C-q (ctrl-p ctrl-q). In order to do this, I need to write the raw characters to the PTY. I have a small mapping at the moment for things like C-d => 0x04, C-h => 0x08.
Is there somewhere I can get a basic mapping of human readable control sequences, mapped to raw byte sequences for xterm?
Take the ASCII value of the character (e.g., for ^H, take 72), and subtract 64. Thus, ^H is 8.
This works for any control character. Using it, you can discover that, for example, ^# is the NUL character and ^[ is ESC.