c# - StreamWritter UTF8 Encoding Error -


We are developing an Android, WP & IOS application using Xamarin's strategy to link file. We have written the WCF REST service for input / output as JSN format data.

In the database class we have used ASCII format and it works fine, but we tried to change the UTF 8 format to support many languages. The error is happening as long as we are getting the error " Remote server encountered an error: (400) wrong request " HttpWebResponse in line

Please find the sample. Please suggest a solution to the database function to send data to WCF REST service with UTF-8.

  Public async jobs & lt; String & gt; GetString & LT; T & gt; (T item, string ServiceAddress, string functionName, String [] parameter, object [] ParameterValues) where T: BusinessLayer.Contracts.IBusinessEntity, New () {string ParameterString = string.Empty; Try {var request = HttpWebRequest.Create (ServiceAddress); Request.ContentType = "App / Jason"; request. Method = "post"; request. Header ["authorization"] = GlobalVallions.gublin; If (parameter parameter> 0) parameter string = "{"; (Int i = 0; I & lt; Parameters.Length; i ++) {ParameterString = ParameterString + "\" "+ Parameter [i] +" \ ": \" "+ ParameterValues ​​[i] + "\" "+", "; } If (parameterLang> 0) {parameter string = parameter string. Remove (parameter string.lambi - 1, 1); Parameter string + = "}"; } // var sw = new streamer (request.GetRequestStream (), System.Text.Encoding.ASCII); Var sw = new streamer (request.GetRequestStream (), encoding. UTF8); Sw.Write (ParameterString); ** // This string has not been passed to the server and displays the tap ** sw.Close (); Using the HttpWebResponse response = request.GetResponse () as HttpWebResponse / / / line breaks down here and came back to capture with no parameter passed. {{Stream Content Reader.ReadToEnd ();} (content! = "") Using output string = (string) Newtonsoft.Json.JsonConvert.DeserializeObject {content (using the StreamReader reader = new streamrider (feedback GaterespanSstream ()) );}}} Hold (exception e) {} return output string;}  


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -