Modified patch uses Yonik's suggestion:
As a useful first step for debugging purposes, it seems like the full
hex of the raw bytes should always be output. If it seems to be
ascii, that could be put in parens.
example: 636f6f6c (cool)
and incorporates Hoss' suggestion for printable Strings:
if i were tasked with
trying to find a way to display in HTML an arbitrary byte that may or
may not be a String, i would start by attempting a String conversion, if
that succeds and all chars in the resulting String are "printable" (
ie: Character.isDefined(c) && ! Character.isISOCOntrol(c)) then display
the first N chars (where N is some reasonable max size to display) ... if
not, then just display the first N characters of the hex string
representing the byte.