# CSV uploads and CRLF/LF

**URL:** <https://www.ruby-forum.com/t/csv-uploads-and-crlf-lf/189895>\
**Category:** Rails\
**Created:** [June 9, 2010, 3:41pm UTC](https://www.ruby-forum.com/t/csv-uploads-and-crlf-lf/189895 "2010-06-09T15:41:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tnyplz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f17d59/32.png) [@tnyplz](https://www.ruby-forum.com/u/tnyplz)\
**Post date:** [June 9, 2010, 3:41pm UTC](https://www.ruby-forum.com/t/csv-uploads-and-crlf-lf/189895/1 "2010-06-09T15:41:36Z")

</div>

Rails models in the database usually have newlines encoded as \r\n  
(CRLF) as they are sent via HTTP and that is how the specification  
indicates they should be sent.

When updating fields in my database by posting a CSV file via HTTP  
from a Linux box the text fields are changed to have \n (LF). I don’t  
know that this causes any issues but if I upload the same data from a  
windows box and then a Linux box, I end up with unnecessary database  
updates as the text fields do vary because they use different  
newlines.

I can update the uploaded CSV string fields with gsub(/([^\015])\012/,  
“\1\015\012”) but I’m wondering if there is some standard way of  
handling this case.

Thanks  
Tony P.
