slang-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

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


Jörg Sommer <joerg@xxxxxxxxxxxx> 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

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]