kattunga / uib

Automatically exported from code.google.com/p/uib
1 stars 2 forks source link

Escaping right-slash ('/') character in json strings #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set a SO member to a string, which contains right-slash (e.g. 'abc/def')
2. Get the SO as JSON
3. JSON representation will contain escaped right-slash 'abc\/def'

What is the expected output? What do you see instead?
I think don't have to escape this character (e.g. JavaScript 'escape' function 
doesn't escape it). It's not a big problem, but I use the SO libraray as a 
serializatin library in a client-server environment. The problem is:
- When I send binary data between client and server, I make a B64 encoded 
string from the binary data, and this data will be serialized (as an object 
member) with SO (AsJson).
- When the binary input contains $FF $FF $FF .. bytes (most common at .xls 
files), it will be B64 encoded as '///...' and Json serialization will escape 
it to '\/\/\/...' which is almost doubles the original (B64 encoded) size...
- This is a common (just for the JSon size) problem for B64 encoded strings, 
because '/' is a valid B64 character...

What version of the product are you using? On what operating system?
Latest (rev. 54), Win XP + Delphi XE2

Please provide any additional information below.
I send a bit modified version (with a conditional define) which doesn't escape 
the right-slash...

And congratulations, the library is a great work!

Best regards,
Leslie

Original issue reported on code.google.com by polyakl...@gmail.com on 21 Feb 2013 at 3:26

Attachments:

kattunga commented 9 years ago

what?