# Bug or normal behaviour with auto replace "\\x3a" code to :?

**URL:** <https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043>\
**Category:** General\
**Tags:** function-node\
**Created:** [6 April 2024 16:00 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043 "2024-04-06T16:00:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![miriumar](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@miriumar](https://discourse.nodered.org/u/miriumar)\
**Post date:** [6 April 2024 16:00 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/1 "2024-04-06T16:00:10Z")

</div>

Hello community,

I am facing some unexpected behaviour when assigning string to msg.url and debugging the value. Function as follow:

 ![imagen](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/393f74d09cd34aba55b9f71e4a707f6c3f4785da.png)

I would have expected debug message to return:  
msg.url = "...://example.com/\x3aBBB\x3aCCC";

But instead, it returns "...://example.com/:BBB:CCC", it transforms "\x3a" into ":" without way to avoid it.  
 ![imagen](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/2/920ecaf41907d138e327b2aa9551f83616f9ba90.png)

Is this normal way of working? I could workaround by double slashing "[https://example.com/\\x3aBBB\\x3aCCC](https://example.com/%5C%5Cx3aBBB%5C%5Cx3aCCC)" but will complicate whole flow enormously...

Thank you,

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 April 2024 17:09 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/2 "2024-04-06T17:09:56Z")

</div>

I didn't think that [https://example.com/\x3a](https://example.com/%5Cx3a)... was a valid url. I thought backslash was not allowed.

---

<div class="post-metadata">

**Author:** ![miriumar](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@miriumar](https://discourse.nodered.org/u/miriumar)\
**Post date:** [6 April 2024 17:53 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/3 "2024-04-06T17:53:23Z")

</div>

I agree on url with backslash should not be valid, however regardless of it, if I assign specific string, I wouldn't expect any transformation unless explicitly specify, don’t we?  
Is it then a bug? Or any other way to workaround it?

The url with backslash works when doing a curl in linux command. I used to get taskid for proxmox api syncjob ( I can show whole command if helps)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 April 2024 18:03 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/4 "2024-04-06T18:03:23Z")

</div>

In a javascript string "\x3a" means hex 3a, which is a colon. I don't know of a way to stop that other than using double backslash.

Interestingly, using encodeURI on your uri leaves it as a colon. Have you checked whether the url with a colon works?

---

<div class="post-metadata">

**Author:** ![piwi447](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/piwi447/32/67335_2.png) [@piwi447](https://discourse.nodered.org/u/piwi447)\
**Post date:** [6 April 2024 18:40 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/5 "2024-04-06T18:40:58Z")

</div>

Could be that the transformation in only in the debug display but the string itself has the value your function gave…

Pierre RUWET

---

<div class="post-metadata">

**Author:** ![miriumar](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@miriumar](https://discourse.nodered.org/u/miriumar)\
**Post date:** [6 April 2024 19:07 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/6 "2024-04-06T19:07:11Z")

</div>

If I replace it with colon, the proxmox api returns "parameter verification failed - 'upid': value does not match the regex pattern".  
Looks like API TaskID (UPID) overcome the special characters with hex. Not only colon but also hyphen "-" is using backslash hex format "\x2d".

This is the curl command that works well though...

 ![imagen](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/0/30767d391df8fc2f8fc16221e13142448b6eb9f9.png)

---

<div class="post-metadata">

**Author:** ![miriumar](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@miriumar](https://discourse.nodered.org/u/miriumar)\
**Post date:** [6 April 2024 19:15 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/7 "2024-04-06T19:15:23Z")

</div>

I was wondering the same but the return throws "JSON parse error". If I change to UTF-8, I can see that return is not the same than the one returned by CURL command. Should be \x3a and returns /x3a.  
So all in all looks like the call is not done as is expected to be received by the API.

---

<div class="post-metadata">

**Author:** ![miriumar](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@miriumar](https://discourse.nodered.org/u/miriumar)\
**Post date:** [6 April 2024 21:02 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/8 "2024-04-06T21:02:13Z")

</div>

I found a way! but requires encoding the backslash itself. Double, quadruple backslashes didn't worked. I had to replace the \ highlighted ones by "%5c" (encoded backslash). Now it returns valid json parsed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 July 2024 21:02 UTC](https://discourse.nodered.org/t/bug-or-normal-behaviour-with-auto-replace-x3a-code-to/87043/9 "2024-07-05T21:02:33Z")

</div>

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