I have XML documents that have many characters that are UTF-8 such as “É” and “é”, and I am trying to put these into Excel, but there is something with the encoding that I am just not getting. I am using Win32::OLE to put the data in Excel.
I have tried this:
use Unicode::String qw(utf8 latin1 utf16le);
my $u = utf8($content);
$output = $u->utf16le;
but the only thing that shows in the Excel cells is the first character of the string (correctly encoded). What am I doing wrong here?
I seem to have found out why. I simply tried:
and that worked perfectly, so I assume that is what encoding Excel uses. The only-showing-first-character part was probably because in utf-16, each character is ended with a null char \0 telling Excel that that’s the entire string. (that’s just an assumption)