jus10h33 / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Special characters encoding is not working #567

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a string with special characters (it may be any thing like symbol too)
2. try to convert that into a class object using fromJson
3. the special characters were not getting mapped to the corresponding varaible

What is the expected output? What do you see instead?
   The expectation is all the special characters to be mapped correctly. but it is not mapped correctly

What version of the product are you using? On what operating system?
  gson 2.2.4, Windows 7

Please provide any additional information below.

Original issue reported on code.google.com by smileven...@gmail.com on 19 Mar 2014 at 4:29

GoogleCodeExporter commented 9 years ago
Please provide example Strings where this conversion is failing

Input
Expected Output
Actual Output

Original comment by inder123 on 26 Mar 2014 at 6:03

GoogleCodeExporter commented 9 years ago
As an example, say you have a java object that has a string variable with the 
value of "<= 40". If you convert that to a Json using the toJson() method it 
will convert the "<" to its unicode value '\u003c'. Now when you convert back 
from a json and deserialize it into the object, the string will be "/u003c=40" 
instead of "<=40". I don't know if this is the intended function but it seems 
odd to have it convert special characters when it goes into a json and not 
convert them back when you deserialize it. 

Original comment by daniel.h...@visibleequity.com on 2 Jun 2014 at 5:41