Data to server special characters

Hi, I need to send data to server from TRB255 device via http. The server expects the data in format:

id,value,timestamp\r\n

I have managed to send send only 1 data successfully, but with more than one it has not been possible, because I cannot insert the cariage return and line feed characters.

How could I insert them?

Greetings.

Hello RJC,

I can have an option you can try for inserting special characters.

In the Data to Server section, for your configuration select edit for the Collection configuration.

Set the Format type to Custom.

Your previous section variable name can be used here and it will be expanded before being sent.

You can try inserting your carriage return (\r) & Newline (\n) after that to see if it sends properly to your server.

In my example server I was able to receive the characters to confirm they are sent without any modification.

I would try this with your server to see if it will interpret the characters appropriately.

It is important to make any custom changes in the Collection config section & not the Data configuration section. As from my testing I saw that any attempt to insert special characters here they were automatically escaped before being sent out.

Please let me know if this method works for your needs.

Hi Chase, thanks for your answer. I had already tried what you mentioned, I show you screenshots of what I get:

1

Content-Length: 21 in this example. Now, after adding the \r\n characters:

2

Content-Length: 25, meaning I am sending 4 characters instead of 2 (‘\’, ‘r’, ‘\’, ‘n’). What I need is to know how to send 2 characters ‘\r’ (ascii 0x0D) and ‘\n’ (ascii 0x0A), as seen in the following figure from the same previous package where these characters are not interpreted in the terminal:

Therefore the method has not worked for me.

I hope I have explained myself better.
Greetings.

Hello @RJC ,

I understand, I am sorry that did not work.

I was not sure if you server receiving the data would interpret the charset differently that would allow that method to work.

I have another option that may work from a colleague if you are comfortable with CLI commands.

If that does not work you may need to implement some pre-process code that can handle the data coming in a different format and change from there.

I know that is not ideal, but there http modules for Python for example that can be relatively easy to setup

The Data_Sender package that this service uses does not provide much wiggle room to re-format too much, so it might be better to implement an in-between process before the data ingests into the final place you require.

Best regards on behalf of Chase,

Hi Marijus, i tried the method and, although inelegant, it worked.

Thank you.

Greetings.

This topic was automatically closed 40 hours after the last reply. New replies are no longer allowed.