in reply to Re: %p issue on perl script
in thread %p issue on perl script

Many thanks for you help.

The %p issue got solved after i changed "printf" to "print" as you suggested.

Below is the code snippet for my second issue (Unicode encodings)

#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use Getopt::Long; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors. +.. my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); # open Excel file my $Book = $Excel->Workbooks->Open("C:/Audio/perl/Project/Voice.xls"); my $Sheet = $Book->Worksheets('Feedback') || die( "No such worksheet gendata" ); my $row_start_tmp = 0; my $row_end_tmp = 0; my $eur_column = 0; my $gom_column = 0; my $nam_column = 0; my $column_add = 0; my @gm_out; my $my_row = 0; my $my_column = 0; my $feedback_value = 0; my $eur_gom_total = 0; my $gom_nam_total = 0; my $eur_nam_total = 0; my $feedback_ID = 0; #--------------------------------------------------------------------- +---------- # TR file name my $fl = "FB_CHECK.csv"; $row_start_tmp = 2; $row_end_tmp = 695; $eur_column = 26; $gom_column = 120; my $i = 0; open(FH, ">$fl") or die $!; # open the excel sheet for write $feedback_ID = 3; foreach my $row ($row_start_tmp..$row_end_tmp) { foreach my $col ($eur_column..$eur_column) { # skip empty cells # next unless defined $Sheet->Cells($row,$column_value)-> +{'Value'}; $my_row = ($Sheet->Cells($row,$eur_column)->{'Value'}); $my_row =~ s/(^\s+|\s+$)//g; $my_column = ($Sheet->Cells($row,$gom_column)->{'Value'}); $my_column =~ s/(^\s+|\s+$)//g; $feedback_value = ($Sheet->Cells($row,$feedback_ID)->{'Val +ue'}); $feedback_value =~ s/(^\s+|\s+$)//g; if ($my_row ne $my_column) { printf " %s At ($row, $col) the row is %s and the colu +mn is %s for EUR & NAM \n", $feedback_value, $my_row,$my_column; push @gm_out, [ $feedback_value, $my_row,$my_column,0 +]; } } } printf FH "\n"; $eur_gom_total = @gm_out; printf FH "The Total mismatches between EUR & GOM is $eur_gom_tota +l \n"; printf FH "\n"; printf FH "Below results for EUR & GOM \n"; printf FH "\n"; printf FH "Row value, EUR English Display Data, GOM English Displa +y Data, NAM English Display Data \n"; my $out_size = @gm_out; for($i=0;$i<$out_size;$i++) { print FH "$gm_out[$i][0],$gm_out[$i][1],$gm_out[$i][2],$gm_out +[$i][3] \n"; }

In the Voice.xls sheet on a particular cell the content is some italy language (other than english) (i cant print since it prints like ???????. ???????)

When i try to print that cell contents to a CSV file it prints as ???????. ???????

I am not aware of unicode strings please help me on this

I got some idea about the issue. This is not because of unicode encodings because the string which causing the problem is not a unicode it is an mandarin language string

How do i print a mandarin language string in a spread sheet? Please help me on this........

Replies are listed 'Best First'.
Re: Use of Unicode Encodings in perl
by bv (Friar) on Sep 11, 2009 at 14:17 UTC

    Glad I could help. As I said before, you should post this second problem in a new question. This one won't get the attention you need to answer it. I can only point you to the documentation: perlunicode

    print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))

      Hi,

      Some how i solved this issue. I set the font to that spread sheet as below and now i dont have any issue in printing non-english strings.

      $Sheet2->Range("A100:Z100")->Font->{FontStyle}="Arial Unicode MS";

      But again i stuck up with another issue on printing the string into a spreadsheet.

      I am printing a string into an spreadsheet with an row input from an for loop. Below is the code snippet of an for loop for better understanding.

      for($i=0;$i<$out_size;$i++) { $Sheet2 -> Range("A$i") -> {'Value'} = $gm_out[$i][0]; $Sheet2 -> Range("B$i") -> {'Value'} = $gm_out[$i][1]; $Sheet2 -> Range("C$i") -> {'Value'} = $gm_out[$i][2]; $Sheet2 -> Range("D$i") -> {'Value'} = $gm_out[$i][3]; }

      Here the problem comes from an "Range". I am getting an error when i run this program an error pointing to "Range".

      Please suggest me an idea on how to input the "Range" with an variable size so that i can print an array $gm_out$ix into the variable ranges of ROW in the columns A, B, C & D.

      Please provide your help

        Here the problem comes from an "Range". I am getting an error when i run this program an error pointing to "Range".

        What error?!