Clojure-Contrib

Control output of non-ASCII characters in clojure-contrib.json

Details

  • Type: Enhancement Enhancement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Current version of JSON output functions perform escaping of non-ASCII characters into \uXXXX sequences, although json allows to use any Unicode character in strings. When working with non-Latin-1 based texts, this lead to additional traffic.

Given patch fixes this problem, leaving old behavior by default, but adding new option to output functions, that now accept :escape-chars option, that control how non-ASCII characters in string will output. When this option has value 'true' (default), then hex sequences are used for these characters, and when 'false', then characters are output as-is

P.S. I sent CA at start of June, so Rich should already have it

Activity

Hide
Stuart Sierra added a comment -

Enhancement committed.

Show
Stuart Sierra added a comment - Enhancement committed.
Hide
Stuart Sierra added a comment -

Alternate implementation committed

Show
Stuart Sierra added a comment - Alternate implementation committed
Hide
Stuart Sierra added a comment -

Patch file submitted 31/Oct/10 does not work. "git am -s" returns "Patch does not have a valid e-mail address." http://clojure.org/patches

Show
Stuart Sierra added a comment - Patch file submitted 31/Oct/10 does not work. "git am -s" returns "Patch does not have a valid e-mail address." http://clojure.org/patches
Hide
Stuart Sierra added a comment -

I'm happy with the idea. Not sure about the implementation.

For other configuration options (keywordizing object fields) I used local arguments, assuming it would be faster than Var lookups. With recent enhancements to Var lookup, that may no longer be true. Need to investigate.

Show
Stuart Sierra added a comment - I'm happy with the idea. Not sure about the implementation. For other configuration options (keywordizing object fields) I used local arguments, assuming it would be faster than Var lookups. With recent enhancements to Var lookup, that may no longer be true. Need to investigate.
Hide
Alex Ott added a comment -

Or you can merge from my clojure-contrib repo from 'unquoted-json' branch - http://github.com/alexott/clojure-contrib/commit/c22da330f1f5b64a5789bde2bbb958cd9fdc31fa

Show
Alex Ott added a comment - Or you can merge from my clojure-contrib repo from 'unquoted-json' branch - http://github.com/alexott/clojure-contrib/commit/c22da330f1f5b64a5789bde2bbb958cd9fdc31fa

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: