Re: problem with File_CSV

From: Date: Tue, 09 Jul 2002 17:53:31 +0000
Subject: Re: problem with File_CSV
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7596@lists.php.net to get a copy of this message
Tomas V.V.Cox (cox@idecnet.com) wrote: > Dan Allen wrote: > > > > I am having a problem with File_CSV and I am not sure if it is just > > me or the class. If you have to use quotes in a field for a csv > > file, you have to either carrot the quote or use two double quotes, > > such as > > > > "This is a ^" field" > > > > or > > > > "This is a "" field" > > > > When I print out the result from the class, I am getting > > > > This is a ^" field > > > > or > > > > This is a "" field > > > > To me, this seems wrong. I would expect > > > > This is a " field > > > > More than wrong, I'd say "intelligent". AFAIK there is no CSV format > spec doc, so my question is: where did you got the info about the quote > scaping? I could add the workarround you suggested (with a new conf > parameter "quote escape char") if you answer my question :) > > Tomas V.V.Cox The request is based on a very loose, not well documented CSV specification called OpenTEXT. Basically it defines three characters, a separator, a boundary character and an escape character. If the boundary character or the escape character shows up in the field, it is proceeded by the escape character, just like in the unix shell and '\'. Excel by default uses '"' as the escape character, but if you export in gnumeric you can specify any character. I encourage you to run an export to csv using gnumeric and you will see where they have this setting. Sorry I can't lead you to actually documentation, but I simply can't find any. Probably why microsoft should go to hell. Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, <dan@mojavelinux.com> http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "If you still don't like it, that's ok: that's why I'm boss. I simply know better than you do." -- Linus Torvalds - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

« previous php.pear.dev (#7596) next »