Hello List,
it's been some time .. ;-)

I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I
have the problem that (char 0) = NIL

 (hex "00")
-> 0
: (char (hex "00"))
-> NIL

 and disappears from the resulting ascii string.

: (setq X
"232302000000010001000F00000000000000323032342D30322D303931302D35342D3035202000000000000000002424")
: (setq Y (chop X))
: (pack (make (while Y (link (char (hex (pack (cut 2 'Y)]
-> "##^B^A^A^O2024-02-0910-54-05  $$"

So how would it be possible to convert the ascii string back to the
original hex string, when all the "00" are gone in the ascii
representation? Shouldn't the (char 0) representation print to something
like ^N or so too, like (char 1), (char 2) etc?

When I try this online converter, the "00" are maintained as blanks:
Hex to ASCII Text String Converter (rapidtables.com)
<https://www.rapidtables.com/convert/number/hex-to-ascii.html>
[image: image.png]

and here is another representation that seems to enable the hex -> ascii ->
hex conversion, getting exactly the same hex string in the end as in the
beginning (not exactly the same conversion as above! just an example how it
might look) :
[image: image.png]
Cheers
Thorsten

Reply via email to