PDA

View Full Version : Issues with Safari inserting Line Feeds in forms




StrongPat
Aug 2, 2004, 09:13 AM
I'm a web developer and have a problem. We have a form that people submit through our site to request information and the info is put directly into a SQL 2000 table and every few hours the table is processed and dropped into a flat file for a rather antiquated system to read. Every now and then we get one that breaks the system because it is putting carriage returns into the field. The field is actually a one line text field and before we put it into the database, we run it through replace functions to remove any CrLf, or Chr(13) chr(10). Nothing seems to work. We recently started tracking the browser type and they all lead back to Safari.

Has anyone else seen this and can you offer up any suggestions?

Thanks



robbieduncan
Aug 2, 2004, 09:55 AM
Is the replace server side or client side? If it's currently server side I would suggest writing a tiny bit of JavaScript to search for \n charachters in the field pre-submission.

Or threaten your users with a pointy stick!

StrongPat
Aug 2, 2004, 10:10 AM
I like the threat part better, but I'll give the javascript a try first.

thanks

broken_keyboard
Aug 2, 2004, 10:19 AM
You need to cater for three different types of line-ends in your server side cleanup script:

Mac: CR
Win: CR LF
Unix: LF

Maybe it is not working for the Mac because you are looking for CR LF but it is only putting CR?

robbieduncan
Aug 2, 2004, 10:38 AM
You need to cater for three different types of line-ends in your server side cleanup script:

Mac: CR
Win: CR LF
Unix: LF

Maybe it is not working for the Mac because you are looking for CR LF but it is only putting CR?

This is why doing it client side might be easier/better as \n is CR on a Mac, CRLF on Windows and LF on Unix :)

broken_keyboard
Aug 2, 2004, 10:53 AM
This is why doing it client side might be easier/better as \n is CR on a Mac, CRLF on Windows and LF on Unix :)

Dude, it is too risky to do it client side, because people can disable Javascript in their individual browser settings and then their database will get corrupted. Unless you know a way to ensure JS is not disabled - I am not a web developer, just an ordinary app developer.

StrongPat
Aug 2, 2004, 11:10 AM
You may be right there, I just checked it and we're checking for the full CRLF

I'll try just CR and see what happens