cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: newline issues

From: Ray Satiro via curl-users <curl-users_at_cool.haxx.se>
Date: Sun, 16 Oct 2016 13:25:16 -0400

On 10/14/2016 9:01 PM, bruce wrote:
> Basically, a portion of the returned content in/from the curl, appears
> to be missing linefeeds (newlines)
>
> The test curl:
>
> echo '' > aa.lwp
> curl -v -A "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
> Firefox/45.0" --cookie-jar aa.lwp --cookie aa.lwp -L
> "http://www.bu.edu/link/bin/uiscgi_studentlink/uismpl?ModuleName=univschs.pl"

[...]

> <TR>
> <TD VALIGN="TOP">
> <SELECT NAME=Subject>
> <OPTION value="">any</option>
> <OPTION VALUE="ZULU">Zulurubang's Studiessngo Speakers of Other
> Languages(TESOL)rning
> </SELECT>
> </TD>

Yup, you're right it's missing newlines. It looks as though the perl
script generating the page for whatever reason uses CRs but not LFs for
that particular section. I get the same content in a browser and curl,
but the output to the screen looks different in the console because of
the mixed line endings. Recall when a CR is output on your screen it
goes back to the beginning of the line without going down a line. for
example

$ printf "eeeee\rdddd\rccc\rbb\ra"
abcde

The same thing is happening here. The page has many options that end in
CR and the last one ends in LF.

<OPTION VALUE="YORUBA">Yoruba[CR]
<OPTION VALUE="ZULU">Zulu[LF]

which becomes

<OPTION VALUE="ZULU">Zuluruba

and many more of those OPTIONs from earlier makes that really weird
string you saw.

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ: https://curl.haxx.se/docs/faq.html
Etiquette: https://curl.haxx.se/mail/etiquette.html

cr_lf_mixed.png
Received on 2016-10-16