Problem with Unicode

Jan 10, 2010 at 10:57 PM

I have the following string "{\"Message\":\"Hi,I\u0092ve send you smth\"}" and after I call the JsonConvert.DeserializeObject method I receive "Hi,I’ve send you smth" instead of "Hi,I’'ve send you smth". The problem is with ' character.

I'm using the last build of Json.NET.

Any solution?

Jan 11, 2010 at 10:10 AM

I think that problem is at my end.


Jan 11, 2010 at 11:28 AM

The problem is for unicode characters that are between \u0080 and \u009f

if I make this everything works perfect

json = json.Replace("\\u0092", "\u0092");

byte[] unicodeByte = Encoding.Unicode.GetBytes(json);

string unicodechars = (Encoding.Default.GetString(unicodeByte)).ToString().Replace("\0", "");

var deserializedObject = JsonConvert.DeserializeObject<T>(json);

Any other suggestions ?


Jan 11, 2010 at 11:45 AM


string json = @"Hi,I’'ve send you smth"; // The @ declares the string as you exactly write it.


Jan 11, 2010 at 7:16 PM

I post an example. I idea is that I receive those message from an API and the message is in unicode, so it has \u0092 characters.


Jan 15, 2010 at 7:50 PM

\u0092 is a single apostrophe so what you are getting is correct. Why do you expect it to be a double quote?


What do you mean there is a problem with all characters between \u0080 and \u009f?