I did email the company that the csv feed is coming from so we'll see what
comes of that.  I really hope they fix it.

Well here is what I did to solve the problem:

I pulled the csv file in using file(), then found the string length, used
substr() to get rid of the first double quote in the line and the newline
and double quote at the end of the line.  Then I replaced all double quotes
with it's html entity equivalent.  Then replaced "," back into ","
since that means those quotes are supposed to be there.. hopefully :)

then I just stuck quotes on the beginning and end of the line.

Created a new file and flushed the data into a new file.

If anybody needs the code, I can send it to them.  Hopefully though the
company will get this fixed!  Cheers!

Rick

>> 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?

"The happiest people are those who think the most interesting thoughts.
Those who decide to use leisure as a means of mental development, who love
good music, good books, good pictures, good company, good conversation, are
the happiest people in the world. And they are not only happy in themselves,
they are the cause of happiness in others." - Phelps


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to