Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

StrongPat

macrumors newbie
Original poster
Aug 2, 2004
5
0
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
 
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!
 
I like the threat part better, but I'll give the javascript a try first.

thanks
 
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?
 
broken_keyboard said:
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 :)
 
robbieduncan said:
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.
 
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.