should newline contain a crlf?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PagCal

    should newline contain a crlf?

    If I want to write client independant code, and generate
    new lines for WINDOWS as well as UNIX, how can I tell
    from a php scrip what to use?

    Should it be '\n' or '\r\n' or '\r' ?

    The unix people don't like the \r's, but if I leave them out,
    the Windows people can't read the generated file.

  • steve

    #2
    Re: should newline contain a crlf?

    "PagCal" wrote:[color=blue]
    > If I want to write client independant code, and generate
    > new lines for WINDOWS as well as UNIX, how can I tell
    > from a php scrip what to use?
    >
    > Should it be ’\n’ or ’\r\n’ or
    > ’\r’ ?
    >
    > The unix people don’t like the \r’s, but if I leave them
    > out,
    > the Windows people can’t read the generated file.[/color]

    If you are asking about detecting Windows vs. Unix, use this code:

    $bWindows = strpos($_ENV[’OS’], "Win") !== false;

    so $bWindows will be true if on Windows machine.

    --
    http://www.dbForumz.com/ This article was posted by author's request
    Articles individually checked for conformance to usenet standards
    Topic URL: http://www.dbForumz.com/PHP-newline-...ict135955.html
    Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=454418

    Comment

    Working...