Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

characters \u2000 through \u20FF are being escaped, but they are not control characters #25

Open
GoogleCodeExporter opened this issue Apr 7, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run this code:
System.out.println(JSONValue.toJSONString("\u2013\u2019\u201c\u201d"));

What is the expected output? What do you see instead?
I think you should see: "–’“”"
(four punctuation characters in quotes)
But I get this: "\u2013\u2019\u201C\u201D"

What version of the product are you using? On what operating system?
json_simple 1.1, linux

Please provide any additional information below.
I looked in the unicode spec, and they are not listed as control characters.

Original issue reported on code.google.com by [email protected] on 3 Jun 2010 at 4:27

@GoogleCodeExporter
Copy link
Author

It's not incorrect to escape a character even is not necessary according to 
JSON spec. The purpose is to eliminate some issues in a certain circumstance. 
But I agree to review it. May I ask what trouble it causes by escaping these 
characters?  

Original comment by [email protected] on 29 Nov 2011 at 3:25

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

If you escape a character in the payload (content of any variable) you are 
changing the content.

Changing a text from "foo - bar" to "foo \u2013 bar" does not seem a good 
solution.

Characters between \u2000 and \u206F are general punctuation symbols.

I can't see any reason for not fixing this. 

Original comment by [email protected] on 30 May 2012 at 9:33

@GoogleCodeExporter
Copy link
Author

For what its worth,  I suffer from the same problem. 

When the Josn decides to escape the charterer it lengthens the string.
And in Push Notification, you are limited by the size of Payload (256 byte 
total) which isn't much. 

So characters in this range \u2000 - \u206F are represent with 6 bytes and not 
2.


Original comment by [email protected] on 31 Jul 2013 at 8:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant