Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Perl Programming Language

Problem in Enforcing utf8 coding for output


Hi,

I have recently upgraded the Perl version on the my machine from 5.6.1
to 5.8.7   And it seems that thereafter, the files generated by my
certain localise.pl has started failing to output files into the ANSI
code instead of ideal UTF-8 encoding.

Here is the certain line that I have managed to create the correct
utf8 output beforehand

        my $output = new IO::File (">$file");

I have tried the following:_

a) my $output = new IO::File(">$file")->utf8->all;
b) my $output = new IO::File(">$file");
    $output->utf8->all;
c) my $output = new IO::File(">:utf8",$file);
d) my $output = new IO::File(">:encoding(utf8),$file);
e) use encoding "utf8";

with absolutely no luck.

I am really a newbie to Perl who has exhausted all imagination on the
issue.   Therefore any help from the Perl gurus out there will be very
appreciated.

Thanks,
Mency

On 05/25/2007 07:48 PM, schwertle@gmail.com wrote:

> Hi,

> I have recently upgraded the Perl version on the my machine from 5.6.1
> to 5.8.7   And it seems that thereafter, the files generated by my
> certain localise.pl has started failing to output [utf8 ...]

The POD (documentation) for IO::File says this:

> METHODS
>        open( FILENAME [,MODE [,PERMS]] )
>        open( FILENAME, IOLAYERS )

And since ':utf8' is an IO layer, I suspect that the correct invocation
would be this:

my $output = IO::File->new('output.txt','>:utf8');

And I tested it, and this is correct.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc