curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Newline escape sequence with -F

From: Jeremy Nicoll via curl-users <>
Date: Sun, 21 Jun 2020 16:43:17 +0100

On Sun, 21 Jun 2020, at 03:36, Alex Ahn via curl-users wrote:
> Here you go.
> Discord is an online application for text and audio communication. It
> was designed for gamers but it became popular beyond its initial
> intended audience.
> I haven't tried putting a multiline text in a file. I should try that
> sooner or later. I'm still new at using cURL.

You certainly should, because I'm not going to be able to.

Thanks for the appreciation!

Are you trying to replicate in curl what you'd otherwise do when logged
on to the Discord system? If you wanted, when logged in, to get some
text to appear with line breaks where you want them, would you just be
typing them in a html form textarea, or is there some sort of online text
editor that gets used?

Have you been able, eg with a browser's debugging tools, to see that
internally in their website, line breaks are passed as "%0A" etc when
the form (if there is one) is submitted? I'm just wondering if there's
some encoding that you don't know anything about, so that eg the line
breaks leave the user-facing form and reach their back end in some
other format.

The reason I was talking about verbose & trace is that there's two halves
to this. One is whether you can get the right characters from the Windows
command line into curl, and the other is whether curl passes the right info
on to Discord's back end.

The first half doesn't require you to be talking to any external server, just
fighting with the terminal window...

In your picture of the command, I'm struck by there being an awful lot of
backtick ` characters. Why? Oh! I see, it's the Powershell escape char.
It's only going to muddy the waters in commands outwith Powershell.

I don't think you're doing yourself any favours with the long series of
(escape and control)-characters apart, repeated literal texts. If it were
me I'd at least have different literals between them, so you can see at a
glance which part of the parameter string corresponds to which thing in
the final result. Ie not lots of "Test for" but eg "literal one", "literal two",
"literal three" or "cat", "dog", "elk", "fox", "gnu" ... or something like that.

Reading a big /picture/ of a command line isn't especially easy, either.
Short of me loading it into an image editor and masking bits out to get
past the irrelevancies, especially if I have to scroll the thing from side to
side... I lose the place. I suppose I could colour different fragments of
the command & corresponding parts of the result, but it's a load of
effort I don't feel like making.

So comparing precisely which escape characters might have had some
sort of effect (even if not the one you wanted) with the result is far
harder than it needs to be.

If you have twenty different forms of experimental escape sequence,
submit 20 separate curl commands and make the literal text in each
one different, or you'll go mad.

Have you read: ?

> For some reason, Command Prompt insists on reformatting instances of \
> into \\.

Does it? You'll need to explain what you mean. Here:

C:\>echo \

C:\>echo \\

C:\>echo \\\

C:\>echo \\\\

Jeremy Nicoll - my opinions are my own.
Received on 2020-06-21