How is the CSV being generated?  Seems to me like your problem isn't
ggetcsv(), but rather the file itself.

Commonly, a CSV file is a series of values, separated by a comma (duh!!).

The separated values are generally enclosed in double quotes ("), as it
would appear yours are.

Any double quotes within each value (eg: she said "hello") are escaped with
a slash (eg: she said \"hello\").

If you are generating the CSV, then you can addslashes() to each value to
escape the quotes, and then later on, stripslashes() to get rid of them.

Sample line from your CSV should look like this:

"1","foo","harry said \"what is it?\"","foo"
"1","bah","\"don't know\" said sally","something"

When echoing these values to the browser, you would strip the slashes.



on 11/12/02 7:13 PM, Richard Baskett ([EMAIL PROTECTED]) wrote:

> I am parsing a csv file with fgetcsv and the fields are surrounding by
> double quotes, now I am running into a problem periodically that when there
> are quotes within the value it is treating it like another value instead of
> the same value.
> Any ideas on how to get around that?
> I am thinking I might have to convert all quotes to " and then turn all
> "," back into quotes and then the first " in the file and
> then last one since obviously they will not have a comma in between them.
> This seems like a while lot of work..
> Ideas?
> Rick
> A wise women once said: " No one can help everybody, but everybody can help
> somebody." - Unknown

Justin French
Web Development & 
Graphic Design

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to