well Lars said that binmode(":encoding...") wasn't encoding.
I thought it was, I very confused here!
Anyway, I've also tried...
------------------------------------
# encode UTF8 octet
use Encode qw(decode encode);
my $octets = encode('UTF-8', $xls);
# output header
$c->response->content_type('application/vnd.ms-excel');
$c->response->content_length(length($octets));
$c->response->header(Content_Disposition =>
'attachment;filename=NBCS_Export.csv');
# create an IO::File for Catalyst
use IO::File;
my $iof = IO::File->new;
$iof->open(\$octets, "r");
#$iof->binmode(":encoding(UTF-8)");
# output XLS data
$c->response->body($iof);
# close file
undef $iof;
-----------------------------------------------
But still if I use the binmode encoding line catalyst falls over with 'wide
character' and if I don't I get a spread sheet full of junk characters?
Either way, it's not working, why would this be?
Craig.
-----Original Message-----
From: Mike Whitaker [mailto:[email protected]]
Sent: 02 July 2013 11:47
To: The elegant MVC web framework
Subject: Re: [Catalyst] CSV / UTF-8 / Unicode
On 2 Jul 2013, at 10:59, Craig Chant <[email protected]> wrote:
>
> utf8::encode($xls);
>
> $iof->binmode(":encoding(UTF-8)");
...erm, haven't you now encoded twice?
Also? Don't use utf8::encode - if you can't use IO layers etc, use the general
Encode module.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended
solely for the individual to whom it is addressed. If this Email has been
misdirected, please notify the author as soon as possible. If you are not the
intended recipient you must not disclose, distribute, copy, print or rely on
any of the information contained, and all copies must be deleted immediately.
Whilst we take reasonable steps to try to identify any software viruses, any
attachments to this e-mail may nevertheless contain viruses, which our
anti-virus software has failed to identify. You should therefore carry out your
own anti-virus checks before opening any documents. HomeLoan Partnership will
not accept any liability for damage caused by computer viruses emanating from
any attachment or other document supplied with this e-mail. HomeLoan
Partnership reserves the right to monitor and archive all e-mail communications
through its network. No representative or employee of HomeLoan Partnership has
the authority to enter into any contract on behalf of HomeLoan Partnership by
email. HomeLoan Partnership is a trading name of H L Partnership Limited,
registered in England and Wales with Registration Number 5011722. Registered
office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is
authorised and regulated by the Financial Conduct Authority.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/