login about faq

I bought yr HTTP component for .net I tthink 6 monthes ago its working freate with me ( I use it to send and get JSON request from a server) Now I face a problem and I think the problem is with yr component I try to send Arabic text with the JSON to the server and it always reach wrong

This is my code

  Dim http As Chilkat.Http = New Chilkat.Http()
            Dim success As Boolean
            success = http.UnlockComponent("")

            http.AllowGzip = False

            http.AddQuickHeader("Cookie", "JSESSIONID=1234")
            Dim certificate As String = "\cert.pfx"
            http.SetSslClientCertPfx(Application.StartupPath & "\" & certificate, "")

            Dim resp As Chilkat.HttpResponse = Nothing
            ' resp = http.PostJson2(Server, "application/json;charset=UTF-8", jsonText) 'http.PostJson(Server, jsonText)
            resp = http.PBinary("POST", Server, System.Text.Encoding.UTF8.GetBytes(jsonText), "application/json", False, False)

JSON : "{"command":"save","password":"xxxxxx","user":"xxxxxx","record":{"__TRANSACTION_ID":"9996668885550","table":"salesorder","contact":"0000002","salesman":"001","docFormat":"Include Tax","comment":"\u0633\u0627\u0645\u064a","branch":"1","orderDetail":[{"item":"000099999","quantity":"13","price":"12.76","bonus":"0"}],"receipt":[],"manualNum":null}}"

Now I try it from PHP (the same JSON above) it reaches ok no problems at all I can see the text normal , only when I use yr component it gace me error I tried PostJson2, PostJson, PBinary,PText So plz tell me what to do Note : \u0633\u0627\u0645\u064a ===سامي

asked Oct 12 '15 at 07:32

Samikaraeen's gravatar image


My mistake.. you also need to specify "utf-8" in the content-type:

resp = http.PText("POST",Server,jsonText,"utf-8","application/json; charset=""utf-8""",False,False)


answered Oct 13 '15 at 14:06

chilkat's gravatar image

chilkat ♦♦

Done thanx a lot

(Oct 17 '15 at 05:39) Samikaraeen

Dear Sami,

Check to see if PText works for you. Do this instead:

resp = http.PText("POST",Server,jsonText,"utf-8","application/json",False,False)

Assuming you are using VB.NET, (just before calling PText) check to make sure the jsonText is valid by displaying the jsonText in a text box. You should see the Arabic chars correctly. If displayed correctly, then we can be confident the string was passed to PText, and (inside Chilkat) it converted to utf-8 correctly and the uf-8 representation of the JSON was used in the HTTP request body.

You can examine the exact bytes of the HTTP request sent by setting the http.SessionLogFilename property.


answered Oct 12 '15 at 08:49

chilkat's gravatar image

chilkat ♦♦

he arabic text in the JOSN string is displayed correctly its passed correctly ,but again it reaches destion in wrong format again when u send the SAME JSON String from PHP it displayed correctly the error in chilkat not in the code JSON Send : "{"command":"save","password":"XXXX","user":"XXXX","record":{"__TRANSACTION_ID":"9996668885609","table":"salesorder","contact":"0000002","salesman":"001","docFormat":"Include Tax","comment":"سامي","branch":"1","orderDetail":[{"item":"000000019","quantity":"4","price":"9.57","bonus":"0"}],"receipt":[],"manualNum":null}}"

"comment":"سامي" is displayed wel

(Oct 13 '15 at 06:09) Samikaraeen

From Log File

---- Sending ---- POST /api/apdemo_6 HTTP/1.1 Content-Type: application/json Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0 Accept-Language: en-us,en;q=0.5 Cookie: JSESSIONID=1234 Accept-Encoding: Host: gw.bisan.com Content-Length: 325

"command":"save","password":"XXXX","user":"XXXX","record":{"__TRANSACTION_ID":"9996668885609","table":"salesorder","contact":"0000002","salesman":"001","docFormat":"Include Tax","comment":"سامي","branch":"1","orderDetail":[{"item":"000000019","quantity":"4","price":"9.57","bonus":"0"}],"receipt":[],"manualNum":null}} HTTP/1.1 200 OK Date: Tue, 13 Oct 2015 09:54:07 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 104 Server: Jetty(9.3.z-SNAPSHOT)



answered Oct 13 '15 at 06:10

Samikaraeen's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 12 '15 at 07:32

Seen: 660 times

Last updated: Oct 17 '15 at 05:39

powered by OSQA