You are here:  » CRLF within CVS File Field being stripped?


CRLF within CVS File Field being stripped?

Submitted by stgelais on Mon, 2009-05-04 16:13 in

It appears the the CRLFs within fields in my CSV file are being stripped entirely by magic parser (and preplaced with nothing) before I get a chance to see them within function call.

For instance, the Description in this record

"MerchantID","Merchant","HeadLineTitle","Description","PromoType","Coupon Code","Entry Date","Start Date","Expires","PromoID","TrackingURL","Banner"
"6916","OverstockArt, LLC.","15% off your Mother's Day orders","15% off coupon for customers + Free Shipping Both Ways (return shipping is free as well)

Promo code: MOM15

Expires May 10, 2009","CouponCode","MOM15","2009-04-22","2009-04-22","2009-05-10","280","http://www.linkconnector.com/ta.php?lc=023967000007002483",""

ends up as this in the MySQL insert query (notice that the CRLFs are stripped)

INSERT INTO as_feeds_promos ( MerchantID, CampaignID, LinkID, PromoID, ProductID, Title, Description, PromoType, CouponCode, StartDate, ExpireDate, TrackingURL, ImageURL ) VALUES (6916, 2483, 7, 280, NULL, '15% off your Mother\'s Day orders', '15% off coupon for customers + Free Shipping Both Ways (return shipping is free as well)Promo code: MOM15Expires May 10, 2009', 'CouponCode', 'MOM15', '2009-04-22', '2009-05-10', 'http://www.linkconnector.com/ta.php?lc=023967000007002483', '');

I would prefer to deal with the CRLFs in the function myRecordHandler($record). Is there a way to do this?

Submitted by support on Mon, 2009-05-04 16:18

Hi there!

Have you double-checked the data to see if they have actually been stripped, or only that they are not apparent, as would be the case being viewed in a web browser?

HTML does not recognise CR/LF as a new-line, so normally, you would use a method to replace it with <br />. For example, in PHP, you can use the nl2br() function...

If that's not the case; if you could perhaps email me a link to the feed (or the feed itself if it is not too large when zipped) and I'll check it out for you...

Cheers,
David.

Submitted by support on Mon, 2009-05-04 16:27

Hello again,

My apologies - I've just checked the functionality for the mutl-line CSV handler and it is stripping CRLF at the moment. I will email you a version with these characters preserved when inside a quoted multi-line text field...

Cheers,
David.