# Sending " character via URScript socket\_send\_line function

**URL:** <https://forum.universal-robots.com/t/sending-character-via-urscript-socket-send-line-function/19636>\
**Category:** URCap Development\
**Created:** [March 3, 2022, 10:58am UTC](https://forum.universal-robots.com/t/sending-character-via-urscript-socket-send-line-function/19636 "2022-03-03T10:58:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keller](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@keller](https://forum.universal-robots.com/u/keller)\
**Post date:** [March 3, 2022, 10:58am UTC](https://forum.universal-robots.com/t/sending-character-via-urscript-socket-send-line-function/19636/1 "2022-03-03T10:58:41Z")

</div>

Hello forum and URCap team,

I am facing a problem, where my URCap produces lexer errors I cannot explain.

I want to send a string containing " characters to a server socket. The server expects the following text (Note the " characters around Value 0):

`values=["Value 0",0,0,0,0,1,1,1,1]`

My scriptWriter generates the following code and escapes the inner " characters, which I think should do the job:

`res = socket_send_line("values=[\"Value 0\",0,0,0,0,1,1,1,1]","server")`

When starting a sample program containing this node, the following error message pops up (Note, there are no escaping characters!):

> Lexer exception on line 148: res = socket\_send\_line(“values=["Value 0",0,0,0,0,1,1,1,1]”,“server”)

Under the Advanced view (script) section of the popup it highlights the part of the command beginning with the second escaped " character:

…\_send\_line("values=[\"Value 0 **\“,0,0,0,0,1,1,1,1]”,"ser…**

Note: in this advanced view, the escaping characters around Value 0 are there again!

**Now can you tell me how it is possible to send strings with escaped " characters via socket\_send\_line?**

Thanks a lot in advance and best regards

Steffen

---

<div class="post-metadata">

**Author:** ![tylerj](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tylerj](https://forum.universal-robots.com/u/tylerj)\
**Post date:** [March 3, 2022, 1:49pm UTC](https://forum.universal-robots.com/t/sending-character-via-urscript-socket-send-line-function/19636/2 "2022-03-03T13:49:48Z")

</div>

the last I knew, you cannot send " characters with URScript. We do this in our URCaps and you have to embed single quotations ’ ’ and convert them on the server side. See this post below about sending json strings which encounters a similar issue:

> [@Sending JSON with socket\_send\_string URScript command](https://forum.universal-robots.com/t/sending-json-with-socket-send-string-urscript-command/8821/2):
>
> Hi Stefan, in a similar case I sent my values to a python daemon which did the [json job](https://www.w3schools.com/python/python_json.asp) and the request. You could convert your message to bytes and send it in a loop: =\> socket\_send\_byte(value, socket\_name=’socket\_0’) or as byte string =\> socket\_send\_line(str, socket\_name=’socket\_0’) On receiving side prepare your json. Iam not sure if you could escape characters in urscript

---

<div class="post-metadata">

**Author:** ![keller](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@keller](https://forum.universal-robots.com/u/keller)\
**Post date:** [March 3, 2022, 1:52pm UTC](https://forum.universal-robots.com/t/sending-character-via-urscript-socket-send-line-function/19636/3 "2022-03-03T13:52:32Z")

</div>

Thanks a lot for this hint, this workaround serves my needs.

Best regards,

Steffen
