[cl-json-devel] Characters

Henrik Hjelte henrik at evahjelte.com
Fri Dec 29 10:44:22 UTC 2006


It seems lika a good idea, so I have applied your patch to the darcs
repository. 

Thanks,
Henrik

On Thu, 2006-12-28 at 17:00 -0800, Ken Harris wrote:
> Hello!
> 
> One thing I discovered when I tried to encode a big s-exp with
> encode-json-to-string is that it doesn't support characters.
> 
> This kind of makes sense, since JSON itself doesn't have a separate
> "character" type, and some of the big usrs of JSON (ECMAscript and
> Python) don't, either.  A JSON decoder couldn't tell what's a length-1
> string, and what's a character.
> 
> OTOH, for my program, it would be really handy to *encode* characters directly.
> 
> I decided to try writing a patch, after about 5 seconds came up with this:
> 
> (defmethod encode-json ((c character) stream)
>   (encode-json (string c) stream))
> 
> Since this is Lisp, it's both insanely easy, and it doesn't have to be
> part of cl-json for me to use it as if it was.  :-)
> 
> I guess it doesn't really benefit me for this to be part of cl-json,
> but if that's of any use to you, feel free to use/add it.
> 
> 
> cheers,
> 
> 
> - Ken
> _______________________________________________
> cl-json-devel mailing list
> cl-json-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-json-devel
> 
> 




More information about the cl-json-devel mailing list