[Cartoweb-users] ClientExportCSV : trouble with header type sended

Oliver Christen oliver.christen at camptocamp.com
Thu Apr 24 02:40:12 EDT 2008


the mime type is effectively not exact, text/comma-separated-values and 
text/csv seems to be the "official" ones.
It certainly make sens to correct that (right now even).

as for tsv, it would be a feature improvment.
As usual you are welcome to provide a patch for the exportCsv plugin to 
extend it's functionalities.

regards
Oliver


> Hi All,
>
> Facing to bugs in excel ( was unable to directly open a csv exported in 
> utf-8)
> I've made a look a ClientExportCSV :
>
> There's a little mistake at the end
>
> getExport look if a separator is defined in configuration
>        if (!is_null($this->getConfig()->separator)) {
>            $sep = $this->getConfig()->separator;
>        } else {
>            $sep = ';';
>        }
>
> But in
>   public function output() {
>      header('Content-Type: application/csv-tab-delimited-table; charset='
>              . Encoder::getCharset());
>       header('Content-disposition: filename=' . $this->fileName);
>       print $this->getExport()->getContents();
>       return '';
>    }
> We found a forced Content-Type which doesn't exist in normal mime.types !
> under debian
> cat mime.types | grep csv
> text/comma-separated-values             csv
> cat mime.types | grep tsv
> text/tab-separated-values               tsv
> under opensuse
> text/x-comma-separated-values csv
> ext/tab-separated-values tsv
>
> This pose some trouble. also the .csv extension is forced.
>
> After long research it would be clear that excel doesn't understand UTF-8 
> (only UTF-16 but in a very Microsoft way)
>
> I think that it could be possible to modify a bit the plugin to use .tsv 
> extension and tab,
> comma and .csv for default. Allowing to send the correct content-type 
> header.
>
> What are your ideas about that ?
>
> -- 
>
>     Bruno Friedmann
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list