Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2006
    Posts
    39
    Plugin Contributions
    0

    Default Stripping newlines and carriage returns.

    Hi,

    I have written a script that exports the contents of the products databes and write a tab delimted text file with results. This is used for importing the inform######## in Gemm (www.gemm.com)

    This all works fine until the script encounters a listing with carriage returns in the comments at which point this is output to the tab delimited text and is interpreted as a new row.

    I have tried to strip these using...

    $products_description = str_replace("/n", " ", $products_description);
    $products_description = str_replace("/r", " ", $products_description);

    before echoing the $products_description into the text file but it doesn't seem to be working.

    Does Zencart store carriage returns inputted in the admin interface as something else?

    Many Thanks.

    Crin

  2. #2
    Join Date
    Nov 2006
    Location
    Papworth, Cambridgeshire, UK
    Posts
    731
    Plugin Contributions
    3

    Default Re: Stripping newlines and carriage returns.

    No, it stores them as carriage returns. You however are trying to replace something else. Carriage returns and linefeeds are denoted by backslashes? "\r" "\n" would probably be more effective

  3. #3
    Join Date
    Nov 2006
    Posts
    39
    Plugin Contributions
    0

    Default Re: Stripping newlines and carriage returns.

    HA HA HA HA HA HA!

    Omg that was stupid. Thanks, sometimes it takes a fresh set of eyes huh!?

  4. #4
    Join Date
    Nov 2006
    Location
    Papworth, Cambridgeshire, UK
    Posts
    731
    Plugin Contributions
    3

    Default Re: Stripping newlines and carriage returns.

    We all do it all the time. Those are usually the most difficult errors to find, because we don't read what is actually there. We "know" what is there.

    Rgds,

 

 

Similar Threads

  1. Send Gift Certificate - Your Message Loses 'carriage returns'
    By tvsupport in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 1 Aug 2011, 08:08 PM
  2. [Done v1.3.8] No newlines in Text-Only Message
    By AlanQ in forum Bug Reports
    Replies: 5
    Last Post: 8 Sep 2007, 12:03 AM
  3. Newlines in text attributes.
    By marknotgeorge in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 8 Jun 2007, 10:26 PM
  4. Remove Shipping and Returns subtitle on Shipping and Returns page
    By photojewelry in forum Basic Configuration
    Replies: 3
    Last Post: 1 Feb 2007, 05:07 PM
  5. Admin redirecting and stripping out the 'www'
    By Waitrose Carpark in forum General Questions
    Replies: 6
    Last Post: 17 Jan 2007, 01:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR