Re: [PHP] Converting tab delimited file to CSV

2008-02-20 Thread Graham Cossey
On Wed, Feb 20, 2008 at 9:50 PM, Chris <[EMAIL PROTECTED]> wrote: > > > Back to my 'original' problem/question, if I '$f = fopen("$file", > > "r")' and 'while ($data = fgets($f))' on the above first format and do > > a $data = str_replace("\t",",",$data); the resulting file looks like > > the s

Re: [PHP] Converting tab delimited file to CSV

2008-02-20 Thread Chris
Back to my 'original' problem/question, if I '$f = fopen("$file", "r")' and 'while ($data = fgets($f))' on the above first format and do a $data = str_replace("\t",",",$data); the resulting file looks like the second example above when opened into Textpad but will not open into separate columns

Re: [PHP] Converting tab delimited file to CSV

2008-02-20 Thread Andrew Ballard
On Feb 20, 2008 3:54 AM, Graham Cossey <[EMAIL PROTECTED]> wrote: > > If it's any help the data I'm getting comes out of a third party > Cognos environment. > > The data opened into Textpad looks like this : > > Column One Column Two Column ThreeColumn Four Column Five > Colu

Re: [PHP] Converting tab delimited file to CSV

2008-02-20 Thread Graham Cossey
I have a suspision the files I receive are in unicode which is causing the problems. How can I categorically determine if a file uses unicode? Am I correct in believing PHP4 doesn't work with unicode files? -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: ht

Re: [PHP] Converting tab delimited file to CSV

2008-02-20 Thread Graham Cossey
On Feb 20, 2008 3:05 AM, Richard Lynch <[EMAIL PROTECTED]> wrote: > On Mon, February 18, 2008 12:08 pm, Graham Cossey wrote: > > proceed accordingly... My biggest gripe with tab delimited files is > > that they are quite a bit bigger than comma delimited files so I may > > have to split the large f

Re: [PHP] Converting tab delimited file to CSV

2008-02-19 Thread Richard Lynch
On Mon, February 18, 2008 12:08 pm, Graham Cossey wrote: > proceed accordingly... My biggest gripe with tab delimited files is > that they are quite a bit bigger than comma delimited files so I may > have to split the large files I receive into smaller 'chunks' to allow > them to be uploaded. This

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 4:01 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: > On Feb 18, 2008 6:45 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote: > > On Feb 18, 2008 1:39 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > > > > > > On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote: > > > > On Feb 18,

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
On Feb 18, 2008 6:45 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote: > On Feb 18, 2008 1:39 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > > > On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote: > > > On Feb 18, 2008 1:08 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: > > > > > > > My bigges

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 1:39 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote: > > On Feb 18, 2008 1:08 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: > > > > > My biggest gripe with tab delimited files is > > > that they are quite a bit bigger than

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Robert Cummings
On Mon, 2008-02-18 at 13:24 -0500, Andrew Ballard wrote: > On Feb 18, 2008 1:08 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: > > > My biggest gripe with tab delimited files is > > that they are quite a bit bigger than comma delimited files so I may > > have to split the large files I receive into

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 1:08 PM, Graham Cossey <[EMAIL PROTECTED]> wrote: > My biggest gripe with tab delimited files is > that they are quite a bit bigger than comma delimited files so I may > have to split the large files I receive into smaller 'chunks' to allow > them to be uploaded. > > Why would tab-

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
On Feb 18, 2008 5:23 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote: > > On Feb 18, 2008 12:02 PM, Edward Kay <[EMAIL PROTECTED]> wrote: > > > > > > On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote: > > > > [snip] > > > > That's funny... MS defaults to tabs for a file whose extension is .csv >

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 12:02 PM, Edward Kay <[EMAIL PROTECTED]> wrote: > > > On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote: > > > [snip] > > > That's funny... MS defaults to tabs for a file whose extension is .csv > > > which is an acronym for (C)omma (S)eparated (V)alues. > > > [/snip] > > > >

RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Edward Kay
> On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote: > > [snip] > > That's funny... MS defaults to tabs for a file whose extension is .csv > > which is an acronym for (C)omma (S)eparated (V)alues. > > [/snip] > > > > Welcome to Microsoftwhere do we want you to go today? > > I think it de

RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Richard Lynch
On Mon, February 18, 2008 10:36 am, Jay Blanchard wrote: > [snip] > That's funny... MS defaults to tabs for a file whose extension is .csv > which is an acronym for (C)omma (S)eparated (V)alues. > [/snip] > > Welcome to Microsoftwhere do we want you to go today? I think it defaults to whatever

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Richard Lynch
On Mon, February 18, 2008 7:11 am, Graham Cossey wrote: > I was wondering if someone could offer some advice please. > > I'm being sent data in tab delimited files which I'm trying to split > into smaller files and convert to comma delimited using PHP. > > Now, I can replace the tabs with commas

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Wolf
Graham Cossey <[EMAIL PROTECTED]> wrote: > I was wondering if someone could offer some advice please. > > I'm being sent data in tab delimited files which I'm trying to split > into smaller files and convert to comma delimited using PHP. > > Now, I can replace the tabs with commas and open

RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Jay Blanchard
[snip] That's funny... MS defaults to tabs for a file whose extension is .csv which is an acronym for (C)omma (S)eparated (V)alues. [/snip] Welcome to Microsoftwhere do we want you to go today? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.p

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Robert Cummings
On Mon, 2008-02-18 at 05:20 -0800, Hiep Nguyen wrote: > On Mon, 18 Feb 2008, Graham Cossey wrote: > > > I was wondering if someone could offer some advice please. > > > > I'm being sent data in tab delimited files which I'm trying to split > > into smaller files and convert to comma delimited usi

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Andrew Ballard
On Feb 18, 2008 8:58 AM, Edward Kay <[EMAIL PROTECTED]> wrote: > > > Now, I can replace the tabs with commas and opening the resulting > > files in a basic text editor all looks fine. > > When you do this, ensure you escape any commas that may exist in the data. > > IIRC, Excel handles this be enc

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
On Feb 18, 2008 1:58 PM, Edward Kay <[EMAIL PROTECTED]> wrote: > > > Now, I can replace the tabs with commas and opening the resulting > > files in a basic text editor all looks fine. > > When you do this, ensure you escape any commas that may exist in the data. > > IIRC, Excel handles this be encl

RE: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Edward Kay
> Now, I can replace the tabs with commas and opening the resulting > files in a basic text editor all looks fine. When you do this, ensure you escape any commas that may exist in the data. IIRC, Excel handles this be enclosing the whole field in "double quotes". Can remember how it handles esca

Re: [PHP] Converting tab delimited file to CSV

2008-02-18 Thread Hiep Nguyen
On Mon, 18 Feb 2008, Graham Cossey wrote: I was wondering if someone could offer some advice please. I'm being sent data in tab delimited files which I'm trying to split into smaller files and convert to comma delimited using PHP. Now, I can replace the tabs with commas and opening the resulti

[PHP] Converting tab delimited file to CSV

2008-02-18 Thread Graham Cossey
I was wondering if someone could offer some advice please. I'm being sent data in tab delimited files which I'm trying to split into smaller files and convert to comma delimited using PHP. Now, I can replace the tabs with commas and opening the resulting files in a basic text editor all looks fin