I was wondering what techniques people use to handle getting different line ending characters from various sources.<div><br></div><div>The specific example I have in mind is a field on a web form. The field uses jQuery to check client side that the input is less than 100 characters, and then we check again on the server side in perl.  If the form is submitted from Windows, then you get two characters per line ending. jQuery converts these to a single character it may think that the text is ok at 99 characters, but the two characters per line ending are actually submitted, so our server side check may think it is (for eg) 103 characters and error.</div>

<div><br></div><div>It is an edge case where client side validation doesn't match the server side validation.</div><div><br></div><div>One common solution seems to be to go to a regex with \r?\n, \015?\012, etc, while another option is to use  Encode::Newlines (which does do regexes internally, but maintaining that is not our concern)</div>

<div><div><br></div><div>A further question is do we convert the line endings for the validation and still store the originally submitted text, or do we store a converted version?</div><div><br></div><div>How do people handle this?</div>

<div><br></div><div>Thanks,</div><div>Stephen</div><div><br></div>-- <br>Stephen Edmonds<br>Technical Lead Applications<br>Production manager for my.monash, Blackboard and Google Apps<br>eSolutions, Monash University<br>

</div>