Re: Problems with text files from a Mac
| From: | Justin French | Date: | Sat, 14 Dec 2002 08:11:08 +0000 |
| Subject: | Re: Problems with text files from a Mac | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128273@lists.php.net to get a copy of this message | ||
1. they can export the CSV as DOS/Windows from Excel on the Mac with ease
2. they can pipe the CSV thru any text editor that lets them choose between
mac/win/unix line endings (BBEdit/Lite for example)
3. $filecontents = str_replace('\r', '\n', $filecontents); //should work
on 13/12/02 1:22 PM, Sterling Anderson (sanderson@hbs.net) wrote:
> I am working on an application for a school district and am having some
> problems with the files they are supplying for import.
> They are supplying data files and I am writing routines to populate the
> database using these files. Its a simple file upload then I just need to
> parse through the tab separated value file. I am using the most recent
> PHP build on Windows with IIS ISAPI and a MSSQL database. They are
> sending text files from a Macintosh application.
> I noticed on the documentation for fgetcsv() that it cannot read the end
> of line character on Mac files. I have not been able to find a good work
> around for this issue. When I grab the entire contents of the file then
> try doing a string replacement on the "\r" or even "\t" for that matter
> it does not work.
> Has anyone found a good solution for dealing with Mac files?
>
Justin French
--------------------
http://Indent.com.au
Web Development &
Graphic Design
--------------------