in reply to Re: Displaying NUL in a TK::Text widget
in thread Displaying NUL in a TK::Text widget

it is customary to replace all non-printable characters (ie 0x00 to 0x1f and 0x7f to 0xff) with a dot
In this case, the non-printable characters have semantic meaning. I want to be able to tell the difference between chr(0) and chr(5).

thor

Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come

  • Comment on Re^2: Displaying NUL in a TK::Text widget

Replies are listed 'Best First'.
Re^3: Displaying NUL in a TK::Text widget
by traveler (Parson) on Nov 08, 2004 at 23:24 UTC
    So how about displaying ".foo." in the button and then when the user does a mouseover, display a tiny window with "\x00foo\x05" or whatever format is most appropriate for your environment?
    --traveler
Re^3: Displaying NUL in a TK::Text widget
by DrHyde (Prior) on Nov 10, 2004 at 09:19 UTC
    You need to then display the numerical values of those characters, such as 0x00, 0x05 and so on. You can't display a character with ASCII value 0x00, because there is no such printable character. Other control characters do weird things, so should never be printed, such as 0x07 (BEL) and 0x0C (FF). Trying to output data containing the special control characters can *really* screw things up.

    You might like to take a look at how such data is displayed by my module Data::Hexdumper. Don't look at the code though, it's old and nasty :-)

      That's the whole point. I wasn't explicit about it, but that's what's done by default for other "weird" characters" in the ASCII set. Try ASCII-6 (ACK) for instance. It would be nice if I could extend the same mechanism to include NUL.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come