Re: DOS-textfile?
| From: | Christophe Chisogne | Date: | Wed, 17 Nov 2004 13:07:08 +0000 |
| Subject: | Re: DOS-textfile? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202286@lists.php.net to get a copy of this message | ||
gustav@varupiraten.se wrote:
is on a Linux-server, but when creating the textfile it is in Mac-mode.If you mean different end of line coding, I guess you mean dos = \r\n *nix = \n mac = \r
can convert the textfile to DOS-textfile through TextPad (An editor)Good editors dont bother user with different kind of end-of-lines (even M$-wordpad do this). And they can convert between them (ex with vim ":set fileformat=dos w" to convert from linux to dos style) A better way (not interactively, within batch files etc) is to use a simple script to do this. Ex under Linux, install and use "flip". Or write a simple php/perl/bash/python/whatever script to do this.
I want the textfile to be in DOS-mode through the PHP-code.A simple way: use "\r\n" in your echo/printf statements. Another way : use "\n" everywhere, as allways. and just use preg_replace if you want to translate end-of-lines PS As dos/win uses ctrl-z (^Z, ascii 26) as end-of-file code -- unix, linux etc dont do such stupid things -- then be carefull to filter that char in generated txt files. (I had the pblm with a simple Perl script not using 'binmode') Christophe