Handling escaped chars (using \ char) from a user



I'm writing a plugin for a serial port program and need to support sending non ASCII chars. I would like to allow the user to express non-ASCII chars in a simple hex escape format: \01 \0D etc

So a sample string would be input as:
\01A01TEST\02
which would be interpreted as a string of these hex chars:
01 41 30 31 54 45 53 54 02

I'm new to TCL so any ideas on better ways to get this done is appreciated.

--Johnny
.



Relevant Pages

  • RE: ascii character - removing chars from string
    ... ascii character - removing chars from string ... "i'm running into a problem where i'm seeing non-ascii chars in the ...
    (comp.lang.python)
  • Terminal and 8-bit chars
    ... is there a definitive solution to the problem of 8-bit chars in Terminal? ... I'm talking about Tiger, bash, and the fact that non-ASCII chars, such as ... I can set Terminal window prefs to UTF-8 display, ...
    (comp.sys.mac.system)
  • Re: creating a testfile for catv
    ... control chars and non-ascii chars: ... As far as "non-ascii" characters, I don't quite get what the OP means. ...
    (comp.lang.c)
  • Re: creating a testfile for catv
    ... control chars and non-ascii chars: ... snip code copied from earlier message thread ... Am I correct to think that the first 32 chars are control chars? ...
    (comp.lang.c)
  • Re: creating a testfile for catv
    ... control chars and non-ascii chars: ... unsigned char buffer; ... Control chars include ...
    (comp.lang.c)