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