<< Back to previous view

[CONTRIB-100] Control output of non-ASCII characters in clojure-contrib.json Created: 31/Oct/10  Updated: 30/Nov/10  Resolved: 30/Nov/10

Status: Resolved
Project: Clojure-Contrib
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Alex Ott Assignee: Stuart Sierra
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File cc.json-escape-chars.patch    

 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



 Comments   
Comment by Alex Ott [ 31/Oct/10 10:10 AM ]

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

Comment by Stuart Sierra [ 30/Nov/10 11:32 AM ]

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.

Comment by Stuart Sierra [ 30/Nov/10 11:34 AM ]

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

Comment by Stuart Sierra [ 30/Nov/10 11:54 AM ]

Alternate implementation committed

Comment by Stuart Sierra [ 30/Nov/10 2:34 PM ]

Enhancement committed.

Generated at Wed Oct 22 00:09:46 CDT 2014 using JIRA 4.4#649-r158309.