[slang-users] keystring conversion to non UTF-8 string?
John E. Davis
davis at space.mit.edu
Fri Aug 18 11:26:56 EDT 2006
Jörg Sommer <joerg at alea.gnuu.de> wrote:
>> The SLang_process_keystring converts ^X to an unsigned byte value using
>> the algorithm
>>
>> (unsigned char) (X - 'A' + 1)
>>
>> This mechanism works for valid control characters ^A-^Z as well as ^@,
>> ^[, ^\, ^], ^^, and ^_.
>
>Can you check for this range, e.g. >= '@' and <= '_'? And outside of this
>range do nothing or throw an error. How else can I give the key sequence
>"^X ^ /"?
Unfortunately, there is no "escape" mechanism for using '^' in a
key-sequence except as the last character. However, you can exploit
the algorithm to achieve the desired result. In particular, the
key-sequence ^X ^ / may be represented by the string "^X^\x9E/", since
'^' = 0x9E-'A'+1.
--John
More information about the slang-users-l
mailing list