Thread

Posted on Mon Mar 20 14:26:11 2006 by szabgab
decoding Hebrew strings?
I am reading in an Excel file with Hebrew text in it.
It seems that Excel keeps thes string in UCS-2BE encoding, whatever that would be.
I am using this code but obviously I am not too satisfied with the idea of overriding the private classes of the module.

What else could I do with this?

sub Spreadsheet::ParseExcel::Simple::_Sheet::next_row { my @values; foreach my $cell (@{$_[0]->{sheet}->{Cells}[$_[0]->{row}++]}) { if ($cell) { if (defined $cell->{Code}) { if ($cell->{Code} eq "ucs2") { push @values, decode("UCS-2BE", $cell->{Val}); } else { push @values, ""; } } else { push @values, $cell->{Val}; } } else { push @values, ""; } return @values; }
Direct Responses: 1976 | Write a response
Posted on Mon Mar 20 17:49:29 2006 by jmcnamara in response to 1973
Re: decoding Hebrew strings?

Apart from this you could apply a patch to the parent Spreadsheet::ParseExcel module to get it to return UTF-8 strings. There are several similar patches mentioned on the Spreadsheet::ParseExcel section of this forum as well as in the Spreadsheet::ParseExcel CPAN RT/bugs section.

John.
--
Write a response