On Saturday, July 5, 2014 9:53:33 PM UTC+2, Andrew Nguyen wrote:
> I am using a combination of pr-str cljs.reader/read-string to communicate
> between the front and backends. Everything has been working as expected but
> I'm now trying to send data that contains a clojure set and pr-str seems to
> be printing an incomplete string.
>
> For example, the following map:
>
> {:a #{:b}}
>
> results in the following string:
>
> "{:a%20"
>
> which then causes read-string to run into an EOF on the backend.
>
> First, are pr-str and cljs.reader/read-string the preferred mechanisms to
> send/receive data on the clojurescript end of things?
>
> If so, is there something I should be doing differently in order to send sets
> back and forth?
>
> Thanks,
> Andrew
Are you sure that pr-str produced that string? %20 is a space urlencoded which
looks like you are urlencoding the value you get from pr-str. Not sure that
will work, but even if it does its far from ideal since basically every literal
has to be urlencoded.
How are you transporting the strings from client -> server, most clients
default to content type "application/x-www-form-urlencoded". What you want to
do is transport the data as is as either text/plain or application/edn,
urlencoding is not a suitable transport encoding (IMHO).
Can't say more without actual code references.
Anyways, HTH.
/thomas
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.