I'm in the process of writing a REST endpoint for uploading CSVs to
[[http://wiki.2600hz.org/display/docs/REST+APIs+%28High-Level+Functionality%29][Crossbar]]
as part of [[http://github.com/2600hz/2600hz-platform][our
communications platform]] at [[http://2600hz.org][2600hz]]. Not wanting
to invoke the full REST client interface, I generally use
[[http://curl.haxx.se/][cURL]] to send the HTTP requests. Today,
however, I had quite the time figuring out why my CSV files were being
stripped of their newline characters. The initial invocation:

#+BEGIN_EXAMPLE
    $> curl http://localhost:8000/v1/path/to/upload -H "Content-Type: text/csv" -X POST -d @file.csv
#+END_EXAMPLE

Walking through the code, from where I was processing the CSV down to
the webserver handling the connection itself, looking for who was
stripping the newlines, I determined it was coming in sans-newlines and
decided to check out [[http://curl.haxx.se/docs/manpage.html][cURL's man
pages]] for what might be amiss. I quickly found that the
[[http://curl.haxx.se/docs/manpage.html#-d][-d option]] was treating the
file as ascii, and although the docs don't explicitly say so, it appears
this option will strip the newlines. The resolution is to use the
[[http://curl.haxx.se/docs/manpage.html#--data-binary][--data-binary
flag]] so cURL doesn't touch the file before sending it to the server.
