You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robby Pelssers <ro...@ciber.com> on 2010/09/13 14:31:07 UTC
wrong encoding used when opening xml file with encoding utf-8
Hi all,
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");
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?
I know this question is a bit of topic but maybe somebody else ever faced and solved this issue.
Kind regards,
Robby Pelssers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: wrong encoding used when opening xml file with encoding utf-8
Posted by Robby Pelssers <ro...@ciber.com>.
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
Re: wrong encoding used when opening xml file with encoding utf-8
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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
RE: wrong encoding used when opening xml file with encoding utf-8
Posted by Robby Pelssers <ro...@ciber.com>.
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>
Robby
-----Oorspronkelijk bericht-----
Van: Robby Pelssers [mailto:robby.pelssers@ciber.com]
Verzonden: ma 13-9-2010 14:31
Aan: users@cocoon.apache.org
Onderwerp: wrong encoding used when opening xml file with encoding utf-8
Hi all,
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");
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?
I know this question is a bit of topic but maybe somebody else ever faced and solved this issue.
Kind regards,
Robby Pelssers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org