i make web service in c# which write with HTTP RESPONE.WRITE json answer but the problem is when i return the json with some field which included the hebrew langauge , after that the json response is not full the end bracket miss.. i put the code in c# and the response of the json string

json response with hebrew fields

{"Response":"OK","FName":"איגור","LName":"kurylo","User_Name":"0524858214","ErrorMsg":"P

json response regulat with english fields :

{"Response":"OK","FName":"igor","LName":"kurylo","User_Name":"0524858218","ErrorMsg":"Pass"}

and thie my code in web service this the model of the json response

public class Android_Reg
{
    public string Response { get; set; }
    public string FName { get; set; }
    public string LName { get; set; }
    public string User_Name { get; set; }

    public string ErrorMsg { get; set; }   
}

string l = Convert.ToString(jSon.Serialize(reg).ToString().Length);
string jsonr = jSon.Serialize(reg).ToString();
var json = JsonConvert.SerializeObject(reg, Formatting.Indented);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "utf-8";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
HttpContext.Current.Response.ContentType = "application/json";
HttpContext.Current.Response.AddHeader("content-length", l);

HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Output.Write(jsonr);

thank you for help :)

Related posts

Recent Viewed