Re: formato de archivo
| From: | Mauricio Rodriguez | Date: | Wed, 19 Jan 2005 18:50:04 +0000 |
| Subject: | Re: formato de archivo | ||
| References: | 1 2 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-53074@lists.php.net to get a copy of this message | ||
Hola Roberto, quiza te sirva esto lo saque del manual de php
You may need to keep in mind the different newline characters
(carriage return - CR, and linefeed - LF) employed by different OS's.
Windows uses CRLF (\r\n), Macintosh uses CR (\r), and *nix systems
generally use LF (\n). nl2br() seems to ONLY replace the \n
character. If you're dealing with text that has been created on a Win
or Mac box (such as input in an HTML textarea), you may have \r or
\r\n termination on the lines. To replace these with the \n standard,
you can use:
$text= preg_replace("/\r\n|\r/", "\n", $text);
- OR -
$text= str_replace('\r\n', '\n', $text);
$text= str_replace('\r', '\n', $text);
(this solution may be faster than the regex)
On Wed, 19 Jan 2005 12:39:55 +0100, Roberto Cesar Najera
<rob@dcaa.unam.mx> wrote:
> Hola lista
>
> tengo un problema con los formatos de archivos
>
> Creo un archivo de texto con saltos de linea y todo bien, el problema es que
> cuando el usuario lo baja a su maquina Windows, no lo puede ver como en
> linux, como ago para converti estos carracteres \n a un salto de linea en
> formato dos de antemano
>
> gracias
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>