in reply to Re^6: Slovenian characters problem
in thread Slovenian characters problem

So it seems to me that the only problem occurs by reading Slovenian characters from Excel table (via Win32::OLE).

Since you are using Spreadsheet::WriteExcel and this is working okay on literal strings, you might want to try using Spreadsheet::ParseExcel to read your input Excel files (instead of Win32::OLE). I don't know how different the two approaches are, since I've never used the OLE module, but I've used ParseExcel, and it seems to work fine (on unix and linux, at least). I've had good experiences with it when the excel data included unicode characters, and maybe that's related to what is happening in your case, but I'm not sure.

Later I'll check the contents of @Test using Data::Dumper

That is certainly the next thing to try -- the sooner, the better. (BTW, I'm glad you're not doing anonymous posts anymore. Welcome to the Monastery!)

Replies are listed 'Best First'.
Re^8: Slovenian characters problem
by JackVanRamars (Novice) on Aug 18, 2010 at 10:58 UTC

    I've added the following line into script:

    use Data::Dumper;

    After I read the xls table contents here is the second one:

    print "\@Test values are: ", Dumper(\@Test);

    I think I'll have to take your advice and give up on Win32::OLE since Data::Dumper reports this:

    Test values are: $VAR1 = [ { 'Col1' => '\x{00c8}\x{00e8}\x{008a}\x{009a}\x{008e}\x{009e +}' } ]; "\x{00e8}" does not map to cp1250 at C:\batch\Pisarna\Clouseau\Testira +nje.pl line 31. "\x{008a}" does not map to cp1250 at C:\batch\Pisarna\Clouseau\Testira +nje.pl line 31. "\x{009a}" does not map to cp1250 at C:\batch\Pisarna\Clouseau\Testira +nje.pl line 31. "\x{008e}" does not map to cp1250 at C:\batch\Pisarna\Clouseau\Testira +nje.pl line 31. "\x{009e}" does not map to cp1250 at C:\batch\Pisarna\Clouseau\Testira +nje.pl line 31.

    I've started with Win32::OLE and then found that I need to add Spreadsheet::WriteExcel as well because it controls Excel colors and other attributes. I hoped I'll use Tk module - but there are about 150 columns of (wide string) data so Tk is not an option (it's very useful for less data though).

    I will deinitely skip Win32::OLE and check how successfull am I with Spreadsheet::ParseExcel. I'll give notice when I make changes - in case some other poor fellow hits the same wall.

    Thanks for your help!

    P.S.: I forgot to log in earlier...

      As I promised - this is the result of what I've just found out.

      I tried the simplest Spreadsheet::Read to read Excel xls file table:

      @ref = ReadData ("FileToRead.xls");

      I write first line with first three columns into @Test:

      push(@Test,{ A1=>$ref[0]->[1]->{A1}, A2=>$ref[0]->[1]->{A2}, A3=>$ref[0]->[1]->{A3} });

      After I write it into another Excel xls table the Slovenian characters are correct. Hallelujah!

      I'll print the code, back it up and only then I'll smooth the code. Thanks again for your help!