There is a problem with hexdump as it emits
upper ASCII chars which do not display correctly
in UTF-88 encoding.
Below, a fix is proposed. In addition, it contains
a more legible digit grouping format.
hexdump swf'' NB. old
000 46 57 53 05-5A 01 00 00 70 00 09 60-00 00 A2 80 âFWSZ..p..`..â
010 00 01 0C 00-43 02 64 64 64 BF 00 89-00 00 00 01 â..Cddd....â
020 00 70 19 09-60 01 90 A2 80 01 00 A0-A7 FF 02 1E â.pâ.`.â
030 00 7F 7F C8-1E 00 FF 00 00 12 09 94-F0 44 C3 C5 â....â.Dâ
hexdump swf'' NB. proposed
000 46 57 53 05 5A 01 00 00 70 00 09 60 00 00 A2 80 FWSZ..p..`....
010 00 01 0C 00 43 02 64 64 64 BF 00 89 00 00 00 01 ..Cddd......
020 00 70 19 09 60 01 90 A2 80 01 00 A0 A7 FF 02 1E .pâ.`.......
030 00 7F 7F C8 1E 00 FF 00 00 12 09 94 F0 44 C3 C5 ......â...D..
NB. =========================================================
NB.*hexdump v show text as hex and ascii characters
hexdump=: 3 : 0
val=. ,y
if. 0=#val do. i.0 0 return. end.
mav=. '.' (0 9 10 13,128+i.128)} a.
hex=. '0123456789ABCDEF'
sep=. ,4#,:3 1#' ';' '
rws=. >. (#val) %16
wid=. >. 16^. rws
dat=. a. i. (rws*16) {. val
end=. 2+ (3*j) + 7<j=. 16 | <: #val
txt=. _16 ]\ dat { mav
dmp=. (16 16#: dat) { hex
dmp=. ;"1 (_16 ]\ <"1 dmp) ,&.>"1 sep
dmp=. (}:dmp),end {. {: dmp
ind=. (((wid$16) #: i.rws){ hex),"1 '0 '
exp=. rws $ >: _8{. 0j1
exp # ind,.dmp,.txt
)
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the
tools to get online.
http://smallbusiness.yahoo.com/webhosting
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm