opened: http://dev.clojure.org/jira/browse/CLJ-1025

On Wednesday, 25 April 2012 04:20:11 UTC+10, Brandon Bloom wrote:
>
> Surprisingly, this differs from JSON, which only supports \u...
>
> On Friday, December 23, 2011 5:43:00 PM UTC-8, Dave Sann wrote:
>>
>> When sending data as strings from clojurescript to clojure there will be 
>> issues if the source data contains certain unicode characters. (I think in 
>> range 128-255 - extended latin characters mostly).
>>
>> This is because the goog string conversion used by pr-str encodes these 
>> characters as \x.. not \u00..
>>
>> read-string will throw an exception if it encounters these characters.
>>
>> Should read-string support these character escapes?
>>
>>
>>
>> by way of work around, I am using:
>>
>> (require '[clojure.string :as s])
>>
>> (defn unescape [string]
>>   (s/replace 
>>     string #"\\x(..)" 
>>     (fn [m] (str (char (Integer/parseInt (second m) 16))))))
>>
>> (defn my-read-string [s]
>>   (read-string (unescape s)))
>>
>> Causes : https://github.com/ibdknox/pinot/issues/16
>>
>> Cheers
>>
>> Dave
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to