​Hi Andy,
 ​

If I stick with Edn are there any other gotchas that should be sanitised ?


The specs of String literals is a bit implicit :
https://github.com/edn-format/edn#strings refers to
https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.6 .

I think there are no ways to persuade read-string to behave differently,
that would break the existing specification.

You could on the other end transform (if it's still useful) your paths to
URLs :

   C:\Documents and Settings\davris\FileSchemeURIs.doc

The corresponding valid file URI in Windows is:

     file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc

​​

As for transit.js, I think you will encounter similar issues, you can check
the spec for string literals in JS :
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals#String_literals
then in JSON : http://www.ietf.org/rfc/rfc4627.txt

var home = "c:\\temp";



Best regards,
Jonathan


On Tue, Nov 25, 2014 at 1:23 PM, Andy Dwelly <andydwe...@gmail.com> wrote:

> I've recently been serialising some data using Edn, and to date this has
> caused no problems. During some tests today, I serialised a string
> representing a file path that originated on a windows machine "\My
> Documents\somedoc.txt". Edn throws a runtime exception when reading this
> back claiming:
>
> java.lang.RuntimeException: Unsupported escape character: \M
>
> Of course it's possible for me to sanitise all strings going out to Edn,
> replacing \ with \\, but I wondered if there's a better way to do this.
> Could Edn read-string opts be used to persuade read-string to behave more
> conveniently ? Alternatively should I be using Transit instead ?
>
> If I stick with Edn are there any other gotchas that should be sanitised ?
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to