in reply to Problem with Writing French Accented Characters in Excel using Perl!
Here is a small working example, using the CP_UTF8 directive, that doesn't require any further conversion after reading in the data in utf8 format:
#!/usr/bin/perl -w use strict; use Cwd; use Win32::OLE qw(CP_UTF8); use Win32::OLE::Const 'Microsoft Excel'; my $application = Win32::OLE->new("Excel.Application"); my $workbook = $application->Workbooks->Add; my $worksheet = $workbook->Worksheets(1); # Make Excel handle UTF8. $Win32::OLE::CP = CP_UTF8; my $file = 'french_utf8.txt'; open FH, '<:encoding(utf8)', $file or die "Couldn't open $file: $ +!\n"; my $row = 1; while (<FH>) { chomp; $worksheet->Cells($row++,1)->{Value} = $_; } $workbook->SaveAs({ FileName => cwd() . '/test.xls', FileFormat => xlNormal, }); $workbook->Close;
Spreadsheet::WriteExcel also handles utf8 text, see the example here.
--
John.
|
|---|