Skip to content

Conversation

@PaulGrandperrin
Copy link

@PaulGrandperrin PaulGrandperrin commented May 5, 2016

This is a WIP trying to solve the problems exposed in Issue #51, PR #58 and PR #65.

TL;DR;
When serializing to JSON, some people might want:

  • Only escaping characters as mandated by ECMA-404, with maximum performance.
  • All Unicode control characters to be escaped (C0, DEL and C1), just like in Python and Ruby, with slightly degraded performance.
  • All non-ASCII characters to be escaped, and therefore generating ASCII compatible JSONs, juste like in Python with the option ensure_ascii =True, with even more degraded performance.

This PR tries to address all these needs.

@oli-obk
Copy link
Member

oli-obk commented May 10, 2016

The travis failure is legit:

src/lib.rs:119:1: 119:21 error: #[feature] may not be used on the stable release channel
src/lib.rs:119 #![feature(unicode)]

and on nightly:

src/ser.rs:650:36: 650:48 error: this function takes 0 parameters but 1 parameter was supplied [E0061]
src/ser.rs:650                         match char.encode_utf16(&mut utf16).unwrap() {
                                                  ^~~~~~~~~~~~
src/ser.rs:650:36: 650:48 help: run `rustc --explain E0061` to see a detailed explanation
src/ser.rs:650:61: 650:67 error: no method named `unwrap` found for type `core::char::EncodeUtf16` in the current scope
src/ser.rs:650                         match char.encode_utf16(&mut utf16).unwrap() {

@dtolnay
Copy link
Member

dtolnay commented Jun 25, 2016

Closing due to inactivity. I would still be interested in offering a choice of what characters to escape if anyone can find a nice way to do it.

@dtolnay dtolnay closed this Jun 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants