robvanderleek / mudslide

Send WhatsApp messages from the command-line
ISC License
120 stars 12 forks source link

New Line have char "\" #62

Closed apie08 closed 7 months ago

apie08 commented 7 months ago

Why after I execute the command with new line, I got "\" after that?

Example :

npx mudslide send me "Hello \nWorld"

Return:

Hello \ World

robvanderleek commented 7 months ago

Hi @apie08

I think you need to escape the slash when using double quotes, or replace the double quotes by single quotes.

So, try this:

npx mudslide send me "Hello \\nWorld"

Or:

npx mudslide send me 'Hello \nWorld'
apie08 commented 7 months ago

This is my code. I'm using C# to open CMD and run the command. image

But it's not working when using single quotes. I have tried it

robvanderleek commented 7 months ago

I think this is a C# specific problem, I've just checked npx mudslide send me 'hello\nworld' and npx mudslide send me "hello\\nworld" in the shell and that works fine. Escaping characters for sub-processes can be tricky, maybe you need \\\\n for it to work but I'm not sure. I'm not using C# myself so can't help you more with this issue.

apie08 commented 7 months ago

Or is it because node js version? because I'm using veesion 16

apie08 commented 7 months ago

Problem solved. Solution is node JS version is not version 18 or latest. Thank you

robvanderleek commented 7 months ago

Great to hear! I'm closing this issue then 🙂