This is the same behaviour as I get in the node-red gui. But when I recieve the packet in PacketSender an additional backslash has been added (screenshots below).
I have, however come up with a solution in that I am using a function to generate the message in hex and then send it in hex. This has solved my problem and is giving the desired result:
var hexString = "5C6170706C65"; // Hexadecimal string to send
var buffer = Buffer.from(hexString, 'hex');
msg.payload = buffer;
return msg;
If you look at the Hex display in your screenshot you will see that the second \ does not actually exist. My guess is that it is being escaped on the display. What does that display look like when you send it as hex?
If you use the inject node to inject a string then it will escape the \ by adding another \ so \apple becomes \\apple - same as if you try to send hello\n to add a carriage return it will send hello\\n as a string... and not with a carriage return character that you want.
You can get round this by setting it to send Json (J) mode instead of String mode - as then "\apple" (now you have to add quotes as well to make it valid JSON) - will then get sent correctly