views:

28

answers:

0

I have raw binary data received from device. I would like to display that data something like HEX editors do - display hex values, but also display corresponding characters.

I found fonts that have characters for ASCII codes 0 - 32, but I cannot get them to show on screen.

I tried this with WPF listbox, itemscontrol and textbox.

Is there some setting that can make this work?
Or maybe some WPF control that will show this characters?

Edit:
After some thinking and testing, only characters that make problems are line feed, form feed, carriage return, backspace, horizontal and vertical tab. As quick solution I decided to replace those characters with ASCII 16 (10HEX) character. I tested this with ASCII, UTF-8 and Unicode files and it works with those three formats.

Here is regex that I am using for this:

rawLine = Regex.Replace(inputLine, "[\t\n\r\f\b\v]", '\x0010'.ToString());

It replaces all occurrences of this 6 problematic characters with some boxy sign. It shows that this is not "regular printable" character and it works for me.