rudolph-miller / jonathan

JSON encoder and decoder.
http://rudolph-miller.github.io/jonathan/overview.html
164 stars 24 forks source link

Fails to encode unicode characters #45

Open eugeneia opened 7 years ago

eugeneia commented 7 years ago

To reproduce:

(jonathan:to-json "λ" :octets t)

The value 955 is not of the expected type (UNSIGNED-BYTE 8).
   [Condition of type TYPE-ERROR]

Version: #<SYSTEM jonathan / jonathan-20170124-git / quicklisp 2017-01-24>

eugeneia commented 7 years ago

The issue is that you are using char-code to write characters as octets, which you shouldn't do, for multiple reasons:

  1. one character does not equal one octet
  2. the result of char-code is implementation dependent