cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: wrong encoding used when opening xml file with encoding utf-8
Date Mon, 13 Sep 2010 14:59:27 GMT

Hi chris,

newer versions of excel support reading data from the web in xml format...  Excel can even
read in complete webpages containing html tables and that was the use case I was talking about.


So i'm sorry about any confusion by not specifying exaclty what i was trying to do.

Robby

-----Oorspronkelijk bericht-----
Van: Christopher Schultz [mailto:chris@christopherschultz.net]
Verzonden: ma 13-9-2010 15:46
Aan: users@cocoon.apache.org
Onderwerp: Re: wrong encoding used  when opening xml file with encoding utf-8
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robby,

On 9/13/2010 8:31 AM, Robby Pelssers wrote:
> I'm generating an html table using Chinese characters and i set the encoding and mimetype
as follows:
> 
> 	var response = cocoon.response;		
> 	response.setContentType("application/vnd.ms-excel; charset=utf-8");	

Uh, isn't application/vnd.ms-excel a binary file format? It shouldn't
have a charset in it's content type.

> 	response.setHeader(
> 	    "Content-Disposition",
> 	    "attachment; filename=" + id + ".xls"
> 	);		
> 	
> 	cocoon.sendPage(
> 		"chemicalcontent/excel/" + rohs + "/" + id + ".xls"
> 	);	
> 
> 
> When previewing the html table in the browser it displays the chinese characters ok.
But when i click the download link and i open the file with excel, it always takes Western
European as charset.. I can manually change that and reload the file but am I missing something
or is excel unable to open an xml file using the correct encoding?

Maybe a sample of the file you're trying to send would be helpful.

> Ok... i found the solution:
> 
> I had to add following META as well to the generated html:
> 
> 
> 	    <head>
> 	      <meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=utf-8"
/>
> 	    </head>

I'm completely confused: you have a Microsoft Excel (.xls) file that is
XML and also contains HTML <head> and <meta> tags? No wonder Microsoft
Excel can't read it.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyOKzsACgkQ9CaO5/Lv0PBMAQCghgwa0r0IBR/BpOT8ublnKXal
3GIAn1Xd1cju+fvOswfg7fJVc+EiEJW/
=mGMR
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



Mime
View raw message