[slang-users] keystring conversion to non UTF-8 string?

John E. Davis davis at space.mit.edu
Thu Aug 17 22:30:49 EDT 2006


Jörg Sommer <joerg at alea.gnuu.de> wrote:
>int main(void)
>{
>    const unsigned char *raw_seq = SLang_process_keystring("^/");
[...]
>Is this expected? Jed does not handle this case, e.g. it prints <EF> if
>it runs in an UTF-8 termnial.

What should it print?  Strictly, speaking "^/" is not a real control
character.  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 ^_.  For ^/, the result is

   (unsigned char) ('/' - 'A' + 1)
    = (unsigned char) (-17)
    = 0xEF

This interface makes no attempt at converting bytes to characters.
That is, it does not produce the two byte sequence <C3><AF>.  Is that
what you were expecting?

Thanks,
--John




More information about the slang-users-l mailing list