<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Moises,</p>
    <p>as far as I can see with your example, the CSV driver behaves
      "properly" in reading and writing of field values with line
      breaks.</p>
    <p>It follows the "Fields with embedded line breaks must be quoted"
      rule of <a class="moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/Comma-separated_values">https://en.wikipedia.org/wiki/Comma-separated_values</a><br>
    </p>
    <p>$ ogr2ogr out.csv /vsizip/dataframe.zip<br>
    </p>
    <p>$ cat out.csv<br>
      id,descriptio<br>
      "1",This is my third row<br>
      "2","this is<br>
      my string<br>
      "<br>
      "3",This is my third row<br>
    </p>
    <p>$ ogrinfo out.csv -al<br>
      INFO: Open of `out.csv'<br>
            using driver `CSV' successful.<br>
      <br>
      Layer name: out<br>
      Geometry: None<br>
      Feature Count: 3<br>
      Layer SRS WKT:<br>
      (unknown)<br>
      id: String (0.0)<br>
      descriptio: String (0.0)<br>
      OGRFeature(out):1<br>
        id (String) = 1<br>
        descriptio (String) = This is my third row<br>
      <br>
      OGRFeature(out):2<br>
        id (String) = 2<br>
        descriptio (String) = this is<br>
      my string<br>
      <br>
      <br>
      OGRFeature(out):3<br>
        id (String) = 3<br>
        descriptio (String) = This is my third row<br>
      <br>
    </p>
    <p>But in your example using /vsistdout/ and -lco CREATE_CSVT=YES is
      going to result in an invalid CSV file which will mix both the
      .csvt and .csv content<br>
    </p>
    <p>Even<br>
    </p>
    <div class="moz-cite-prefix">Le 24/04/2023 à 13:34, Moises Calzado
      via gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAObRW4Tm7-Kg76344Aoh1Mix24-yT2Szd9ivqvV0eMRP=KTEag@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hello!
        <div><br>
        </div>
        <div>We're trying to convert a Shapefile into a CSV using
          ogr2ogr and we're having some issues while dealing with some
          columns that contain line breaks inside their values. If we
          have a line with the following string, ogr2ogr detects that
          the line break is a new line and it returns two lines.</div>
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">"this
          is my \n value"</blockquote>
        <div><br>
        </div>
        <div>That's the command that we're executing:</div>
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">ogr2ogr
          -f CSV -skipfailures -makevalid /vsistdout/
          /vsizip/shapefile.zip -simplify 0.00001 -dim XY -t_srs
          EPSG:4326 -lco GEOMETRY=AS_WKT -lco GEOMETRY_NAME=geom -lco
          CREATE_CSVT=YES > result.csv<br>
        </blockquote>
        <div><br>
        </div>
        <div>Is this an expected behaviour, or is there any way to avoid
          this?</div>
        <div>Sharing an example Shapefile so that you can try to
          reproduce that behaviour: <a
href="https://drive.google.com/file/d/1gFqfTP02KTFoavJyyO-Ix05YwZB2tS24/view?usp=sharing"
            moz-do-not-send="true" class="moz-txt-link-freetext">https://drive.google.com/file/d/1gFqfTP02KTFoavJyyO-Ix05YwZB2tS24/view?usp=sharing</a></div>
        <div><br>
        </div>
        <div>Thanks so much in advance,</div>
        <div>Regards.<br clear="all">
          <div><br>
          </div>
          <span class="gmail_signature_prefix">-- </span><br>
          <div dir="ltr" class="gmail_signature"
            data-smartmail="gmail_signature"> <strong>Moises Calzado</strong>
            <p style="margin-bottom:4px;margin-top:4px"> Support
              Engineer </p>
            <p style="margin-bottom:20px;margin-top:4px"> +34671264286 |
              <a href="mailto:mcalzado@carto.com" target="_blank"
                moz-do-not-send="true" class="moz-txt-link-freetext">mcalzado@carto.com</a>
              | <a href="https://www.carto.com/" rel="nofollow"
                target="_blank" moz-do-not-send="true">CARTO</a> </p>
            <a
              href="https://spatial-data-science-conference.com/2023/london/"
              rel="nofollow" target="_blank" moz-do-not-send="true"> <img
src="https://storage.googleapis.com/carto-it-files/signature/SDSC-2023-LND_Signature-mail.jpg"
                moz-do-not-send="true" width="516.656px" height="50"> </a>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>