Zulu-Inuoe/jzon

bug when `stringifying` exponent markers

Closed this issue · 5 comments

Hi
Firstly thank you for this library!
There is probably a bug when stringifying floats with (any) exponent markers:

(jzon:stringify 1.0d0)                ;; =>  "�^@.0"
(jzon:stringify 12.0d0))            ;; =>   "�^@1.0"
(jzon:stringify 123456.0s0)     ;; =>   "^@12345.0"

;; 

I'll try to come up with a PR; but in the meantime, would appreciate if anyone has an idea.
Thank you!!

This is very odd and looks like some kid of encoding issue.. Can I ask for details on where you're running this? OS and version information?
Also the version of SBCL

@Zulu-Inuoe Yes sorry. I am using the latest SBCL (2.3.4) on MacOS silicon

Okay. Could you share the output at the repl when you eval (map 'list #'char-code "e+-.0123456789") ? It might be that the encoding differs for some reason.

Here:

* (map 'list #'char-code "e+-.0123456789")
(101 43 45 46 48 49 50 51 52 53 54 55 56 57)

Hey @jsulmont thank you so much for reporting this. I had a bad implementation of the printer when writing numbers without exponent or decimal parts. I can't believe I hadn't run into this before, since it's been there from the beginning.
#46
should fix this