cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

PostMultipart : have problem as there's chinese character in partsToSend

RC_8716579
6-Contributor

PostMultipart : have problem as there's chinese character in partsToSend

Hello, recently I use PostMultipart, and these's chinese character in my partsToSend
so I set the headers like this:

 

 

 

 

var params = {
proxyScheme: undefined /* STRING */,
headers: {"Content-type":"multipart/form-data; charset=UTF-8"} /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
partsToSend: formData /* INFOTABLE */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
repository: undefined /* STRING */,
proxyHost: undefined /* STRING */,
url: url /* STRING */,
};

// result: JSON
var result = Resources["ContentLoaderFunctions"].PostMultipart(params);

 

 

 

 


Here I print out the content which api server received:

Red: If I remove the content of headers, every chinese character  will become to "?"
Orange: There's no problem as I use Postman to test the api

Green: the content which api server received will become to nothing as setting the headers

RC_8716579_0-1629812654251.png

I also try to set headers: {"Content-type":"charset=Big5"} but the result is the same as UTF-8


anyone can help me?
thanks a lot!

5 REPLIES 5
slangley
23-Emerald II
(To:RC_8716579)

Hi @RC_8716579 

 

What version of ThingWorx are you running?  Can you provide more detail around your use case?  What are you sending it to?

 

Regards.

 

--Sharon

 

RC_8716579
6-Contributor
(To:slangley)

The version of Thingworx is 8.4.

In the detail, I write the RESTful API by golang and test it by postman, it seems work normally.
And I want Thingworx to get the data from the API by POST method.

Is it not ok to use form-data ?

slangley
23-Emerald II
(To:slangley)

Hi @RC_8716579 

 

Do you get any results for non-chinese characters or is it always blank?

 

Can you clarify what the target and source servers are?

 

We're going to test this under a recent release as ThingWorx 8.4 is no longer supported.

 

Regards.

 

--Sharon

RC_8716579
6-Contributor
(To:slangley)

Hi Slangley,

Sorry for the late reply.

We always get the "?" characters while using the "PostMultipart" function to post form-data to our owned APIs.

Our APIs server is just run by simple GET/POST HTTP methods for RESTful services.

Recently we solved this problem by using the "PostJSON" function, it's weird it works with a different function but the same body and server.

Hope that we can find out the problem with the "PostMultipart" function, thank you.

 

 

slangley
23-Emerald II
(To:RC_8716579)

Hi @RC_8716579.

 

Glad you found a workaround.  Is it possible you were working with JSON instead of an infotable?  Can you provide the code you used for generating the infotable?

 

Regards.

 

--Sharon

 

 

Top Tags