Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

printing Chinese, Japanese, french Text in excel using perl

by perl-nun (Initiate)
on Jul 29, 2013 at 09:16 UTC ( #1046802=perlquestion: print w/ replies, xml ) Need Help??
perl-nun has asked for the wisdom of the Perl Monks concerning the following question:

I have a string($str) that has some chinese, french and japanese text(in the same string) that are read from the Database. It is read correctly which I am able to verify by printing in the web page directly. But I am not able to write it in a excel file. Tried this:
@arr = split(',',$str); $arrayref = \@arr;

Now, when I try to print it, using :
 $worksheet->write_row($count,0,$arrayref); I get question marks in the place of special characters. So I tried : $str = encode("utf8",$str); . Still the same problem persists. Someone kindly guide me as how to do it.

Comment on printing Chinese, Japanese, french Text in excel using perl
Select or Download Code
Re: printing Chinese, Japanese, french Text in excel using perl (modulename)
by Anonymous Monk on Jul 29, 2013 at 09:22 UTC
    What is $worksheet? This is critical information
      Its a page in excel workbook.
      my $workbook = Spreadsheet::WriteExcel->new('perl.xls'); $worksheet = $workbook->add_worksheet();
Re: printing Chinese, Japanese, french Text in excel using perl
by davies (Vicar) on Jul 29, 2013 at 11:52 UTC

    Your symptoms seem the same as the ones I experienced when writing Re: Extracting Chinese characters from Excel. I shouldn't be surprised if you needed some VBA to solve your problem. It was the only way I could make it work. You won't be able to do this with things like Spreadsheet::WriteExcel; you will need Win32::OLE.

    Regards,

    John Davies

      @All : Thank you! I just did it by using the decode function in Encode module.
      use Encode qw(decode encode); $str = decode("utf8",$str);
      This did it all! Thanks again!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1046802]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (478 votes), past polls