vsdeepthi has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have the below code when run as a perl script works fine generating a word document with proper french accents. Perl Script ===========
#!/usr/local/bin/perl use XYZ; my $x = new XYZ(); $x->gen_pb(); 1;
And the module XYZ has code like below:
package XYZ; sub gen_pb { $template->process("$dir/$input",$vars, \$content, {binmode => ':encod +ing(utf8)'} ) || return "Template Error: " . $ +template->error(); unlink($doc_file) if(-e $doc_file); open(FHPB,">$doc_file"); binmode( FHPB, ":encoding(UTF-8)" ); print FHPB $content; close FHPB; }
But the same module when called from a CGI generates the word document but without the french accents. Perl CGI Program
#!/usr/local/bin/perl use CGI::Application; use XYZ; .... my $x = new XYZ(); $x->gen_pb();

Replies are listed 'Best First'.
Re: Problem writing french accents to a word file using CGI::Application
by CountZero (Bishop) on Apr 04, 2015 at 20:18 UTC
    But the same module when called from a CGI generates the word document but without the french accents

    So what do you get instead of the "French accents"?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      I get text without annotations. For example ê is shown as e.
        That is very strange. I have never heard of the accents simply disappearing but leaving the basic character in place.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics
Re: Problem writing french accents to a word file using CGI::Application
by Anonymous Monk on Apr 05, 2015 at 01:46 UTC

    Why aren't you error checking?