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

victor valencia vhva1976 at yahoo.es
Thu Apr 24 05:38:48 EDT 2008


Bruno:

I could not open a csv directly in Excell, but if open first a blank document and then import a text document, Excell will allow you to select the UTF-8 to get your csv right open. In windows vista choose Data -->from text...

Bye

Victor

----------------------------------------------------------------------

Message: 1
Date: Wed, 23 Apr 2008 10:00:04 +0200
From: Bruno Friedmann <bruno at ioda-net.ch>
Subject: [Cartoweb-users] ClientExportCSV : trouble with header type
    sended
To: cartoweb-users at lists.maptools.org
Message-ID: <480EEC84.7070305 at ioda-net.ch>
Content-Type: text/plain; charset=UTF-8

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







      ______________________________________________ 
Enviado desde Correo Yahoo! La bandeja de entrada más inteligente.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20080424/f3e4e89e/attachment.html


More information about the Cartoweb-users mailing list