suno has asked for the wisdom of the Perl Monks concerning the following question:
Greetings!
I have a powerbuilder debug file which is in unicode. I tried encoding it and did some processing. the code is as below:
#!/usr/bin/perl my $input=$ARGV[0]; open(INFILE,'<:encoding(utf-16LE)',$input) or die("Not able to open th +e input file $input $!"); while(<INFILE>) { my $currentline=$_; next if($currentline=~/^\s+(CLOSE|OPEN)\s+/i); print $currentline; }
Next is, I need to decode the modified encoded source file. I tried the below code for decoding but still got empty lines.
I am finding it a bit tough to understand and get a solution for decoding.Please help me in this. Thanks in advance.open my $fh, '>:encoding(utf-16LE)', $currentline; open my $fh, '<:encoding(utf-16LE)', $menufile;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Encoding and decoding a Unicode
by afoken (Chancellor) on Jul 10, 2015 at 12:31 UTC | |
by suno (Acolyte) on Jul 10, 2015 at 16:26 UTC | |
Re: Encoding and decoding a Unicode
by vinoth.ree (Monsignor) on Jul 10, 2015 at 12:02 UTC | |
Re: Encoding and decoding a Unicode
by Anonymous Monk on Jul 10, 2015 at 12:03 UTC | |
Re: Encoding and decoding a Unicode
by andal (Hermit) on Jul 13, 2015 at 07:25 UTC | |
Re: Encoding and decoding a Unicode
by u65 (Chaplain) on Jul 10, 2015 at 11:43 UTC |
Back to
Seekers of Perl Wisdom