SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Square boxes in excel (\r\n in implode()) ?

    Sorry if this has been posted before. i did a couple searches but no solutions came up.

    my webhost is on a unix box and whenever i download files from the server via
    PHP Code:
    header("Content-Type: application/octet-stream");
    header("Content-disposition: attachment;filename=test.txt");
    // $array is a bunch of answers that users typed in; extracted from mysql
    implode($array','); 
    i get

    Code:
    hello[]world,foobar
    instead of
    Code:
    hello
    world,foobar
    is there a way to make implode use \r\n than \n on strings that have returns?
    Last edited by GeekSupport; Aug 8, 2003 at 11:43.

  2. #2
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or even make apache (.htaccess?) make \r\n default for \n

  3. #3
    SitePoint Member
    Join Date
    Jan 2003
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm not sure what you're asking, windows should read \n fine, while linux may read \r\n as \n\n

    you can always $str = preg_replace('/\r\n|\n\r|\r|\n/', "\n (or whatever return you want)", $str);


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
  •