mkovatsc / Copper

Copper (Cu) CoAP user-agent (JavaScript implementation)
http://people.inf.ethz.ch/mkovatsc/copper.php
BSD 3-Clause "New" or "Revised" License
94 stars 43 forks source link

binary data visualisation fixes #10

Closed chrysn closed 9 years ago

chrysn commented 9 years ago

looking at binary data (eg. memory dumps) using copper looks quite messy. the attached patches make the hex view always align nicely by limiting it to printable characters, and narrows down the criteria for utf8 decoding in bytes2str (eg. in the message log) to only produce unicode characters when the affeced bytes really look like unicode.

some cleanup on existing code in that area is included for enhanced readability.

mkovatsc commented 9 years ago

Thanks for the improvement! Looks good.

Displaying binary started as a quick hack that never evolved. Hence, the renderBinary function is still quite annoying for large, blockwise data. The inefficient loops would need to be changed to work with cached partially rendered data at some point...