ClojureScript

Stop using goog.string.quote to escape strings for printing

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

The contract of goog.string.quote is to produce a "valid JavaScript string", which can end up being quite different from what is expected by e.g. the Clojure reader and other edn-compatible readers. This has been discussed in a variety of threads/issues:

The most significant issue is that characters > 127 and < 256 are outputted with an \x.. escape sequence, which no other reader supports. Further, other Unicode characters are always escaped using the \u.... notation; this is not a functional difference, but can be a stumbling block, e.g. when viewing data that had been pr-str'd that contains high codepoint characters.

The most straightforward fix is to take control of printed string escaping to ensure the results conform first to the expectations of existing readers (primarily Clojure's and ClojureScript's), and to the formal [edn specification](https://github.com/edn-format/edn/) as that matures.

This ticket supersedes http://dev.clojure.org/jira/browse/CLJ-1025.

Activity

Chas Emerick made changes -
Field Original Value New Value
Patch Code and Test [ 10002 ]
Attachment CLJS-400.diff [ 11583 ]
Chas Emerick made changes -
Attachment CLJS-400-fast.diff [ 11584 ]
Chas Emerick made changes -
Attachment CLJS-400.diff [ 11583 ]
Chas Emerick made changes -
Attachment CLJS-400-fast.diff [ 11584 ]
Chas Emerick made changes -
Attachment CLJS-400.diff [ 11596 ]
David Nolen made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: