I have text with € signs in a nvarchar column on a MSSQL 2008 Server and want to dump that text via Spreadsheet::WriteExcel into an Excel file but I always get some wired sign out instead of €.
Until now I put my string together in perl directly and used always something like
my $euro = chr 0x20AC;
$worksheet->write($currentline, $currentcolumn, "Some text here".$euro ,$format);
which always worked.
Any hints?
- ActivePerl v5.10.0
- Windows
- MSSql Server 2008
- Access per ADO =>
Win32::OLE->new("ADODB.Recordset");
Unicode handling in Spreadsheet::WriteExcel is relatively straightforward: if the string you are trying to write is in utf8 format then it gets written to the Excel file exactly as you would expect.
Ensuring the strings you are writing are in utf8 format isn’t always as straightforward.
To resolve the issue you just need to figure out what encoding the strings coming from MSSQL are in and then use the Encode module to convert them to utf8. For example:
Have a look at the unicode perldocs linked in the WriteExcel section above for some background.