bracket checker - http://pastebin.com/d8GNL0kx - Any clue on the error?

bracket checker - http://pastebin.com/d8GNL0kx - Any clue on the error?

am 29.07.2011 00:25:54 von newbie01 perl

--20cf30427190f53d9704a928a5ba
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,

Am just trying out this bracket checker script but when I ran it, it is
giving errors below.

Just curious to know what the error is about? Please advise. Thanks

Error below:

http://pastebin.com/d8GNL0kx

../123.pl testfile01x.ora
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xab) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xab) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xab) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xab) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xab) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xab) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Malformed UTF-8 character (unexpected continuation byte 0xbb) at ./123.plli=
ne 8.
Sequence (?|...) not recognized before HERE mark in regex m/(?| << HERE
(\()(?&matched)([\}\]..»?>»??]|$) |
(\{)(?&matched)([\)\]..»?>»??]|$) |
(\[)(?&matched)([\)\}..»?>»??]|$) |
(.)(?&matched)([\)\}\].»?>»??]|$) |
(.)(?&matched)([\)\}\].»?>»??]|$) |
(«)(?&matched)([\)\}\]..?>»??]|$) |
(?)(?&matched)([\)\}\]..»>»??]|$) |
(<)(?&matched)([\)\}\]..»?»??]|$) |
(«)(?&matched)([\)\}\]..»?>??]|$) |
(?)(?&matched)([\)\}\]..»?>»?]|$) |
(?)(?&matched)([\)\}\]..»?>»?]|$) | at ./123.pl line 34.


Code below or can be copied from http://pastebin.com/d8GNL0kx

#!/usr/bin/perl

use strict;
use utf8;
binmode STDOUT,":utf8";
use File::Find;

my $checkre =3D qr/(?|
(\()(?&matched)([\}\]”›»】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
(\{)(?&matched)([\)\]”›»】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
(\[)(?&matched)([\)\}”›»】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
(â€=9C)(?&matched)([\)\}\]›»】〠‰ã=80=
‹ã€ã€=8F]|$) |
(â€=B9)(?&matched)([\)\}\]”»】〠‰ã=80=
‹ã€ã€=8F]|$) |
(«)(?&matched)([\)\}\]”›】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
(ã€=90)(?&matched)([\)\}\]”›»〠‰ã=80=
‹ã€ã€=8F]|$) |
(ã€=88)(?&matched)([\)\}\]”›»〠‘ã=80=
‹ã€ã€=8F]|$) |
(ã€=8A)(?&matched)([\)\}\]”›»〠‘ã=80=
‰ã€ã€=8F]|$) |
(ã€=8C)(?&matched)([\)\}\]”›»〠‘ã=80=
‰ã€‹ã€=8F]|$) |
(ã€=8E)(?&matched)([\)\}\]”›»〠‘ã=80=
‰ã€‹ã€=8D]|$) |
(^)(?&matched)([\)\}\]”›»】ã=8 0‰ã=80=
‹ã€ã€=8F]))
(?(DEFINE)(?(?:
\((?&matched)\) |
\{(?&matched)\} |
\[(?&matched)\] |
â€=9C(?&matched)â€=9D |
â€=B9(?&matched)â€=BA |
«(?&matched)» |
ã€=90(?&matched)ã€=91 |
ã€=88(?&matched)ã€=89 |
ã€=8A(?&matched)ã€=8B |
ã€=8C(?&matched)ã€=8D |
ã€=8E(?&matched)ã€=8F |
[^\(\{\[“‹«【〈ã€=8A= E3€Œ=E3=
€Ž\)\}\]”›»】〉〠‹ã€=E3=
€]++)*+))
/sx;

sub check_file {
if(-f && /\.txt$/) {
if(open(my $fh,'<:encoding(UTF-8)',$_)) {
undef $/;
my $data =3D <$fh>;
if($data =3D~ $checkre) {
if(!length $2) {
print "File $File::Find::name has unclosed bracket $1 a=
t
position $-[1]\n";
}
elsif(!length $1) {
print "File $File::Find::name has unopened bracket $2 a=
t
position $-[2]\n";
}
else {
print "File $File::Find::name has mismatched brackets $=
1
$2 at positions $-[1] and $-[2]\n";
}
}
} else {
print STDERR "Cannot open $File::Find::name: $!\n";
}
}
}

@ARGV =3D ('.') unless @ARGV;
find(\&check_file,@ARGV);

--20cf30427190f53d9704a928a5ba--

Re: bracket checker - http://pastebin.com/d8GNL0kx - Any clue on the error?

am 29.07.2011 11:33:27 von timothy adigun

--00248c0eefd848c73a04a931f9c2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi newbie01 perl,

The code you posted worked fine, if only you save your perl
file (e.g exec2.pl - it doesn't matter the name of ur perl file),
using UTF-8 Encoding.
###### HOW TO SAVE USING UTF-8 ENCODING ##########
Copy the codes into notepad and give it any name you like
but you must end with ".pl" or ".plx", on the File name
then on Save as type: change to "All Files",
then Encoding: use "UTF-8" (or any other,except ANSI), instead of using
default "ANSI".

My experience:Some times one gets error like ds when codes are copied
directly from pdf e-books.
-- happy coding!

On Thu, Jul 28, 2011 at 11:25 PM, newbie01 perl wr=
ote:

> Hi,
>
> Am just trying out this bracket checker script but when I ran it, it is
> giving errors below.
>
> Just curious to know what the error is about? Please advise. Thanks
>
> Error below:
>
> http://pastebin.com/d8GNL0kx
>
> ./123.pl testfile01x.ora
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xab) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xab) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xab) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xab) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xab) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xab) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Malformed UTF-8 character (unexpected continuation byte 0xbb) at
> ./123.plline 8.
> Sequence (?|...) not recognized before HERE mark in regex m/(?| << HERE
> (\()(?&matched)([\}\]..»?>»??]|$) |
> (\{)(?&matched)([\)\]..»?>»??]|$) |
> (\[)(?&matched)([\)\}..»?>»??]|$) |
> (.)(?&matched)([\)\}\].»?>»??]|$) |
> (.)(?&matched)([\)\}\].»?>»??]|$) |
> («)(?&matched)([\)\}\]..?>»??]|$) |
> (?)(?&matched)([\)\}\]..»>»??]|$) |
> (<)(?&matched)([\)\}\]..»?»??]|$) |
> («)(?&matched)([\)\}\]..»?>??]|$) |
> (?)(?&matched)([\)\}\]..»?>»?]|$) |
> (?)(?&matched)([\)\}\]..»?>»?]|$) | at ./123.pl line 34.
>
>
> Code below or can be copied from http://pastebin.com/d8GNL0kx
>
> #!/usr/bin/perl
>
> use strict;
> use utf8;
> binmode STDOUT,":utf8";
> use File::Find;
>
> my $checkre =3D qr/(?|
> (\()(?&matched)([\}\]”›»】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
> (\{)(?&matched)([\)\]”›»】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
> (\[)(?&matched)([\)\}”›»】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
> (â€=9C)(?&matched)([\)\}\]›»】〠‰ã=80=
‹ã€ã€=8F]|$) |
> (â€=B9)(?&matched)([\)\}\]”»】〠‰ã=80=
‹ã€ã€=8F]|$) |
> («)(?&matched)([\)\}\]”›】ã=80 ‰ã=80=
‹ã€ã€=8F]|$) |
> (ã€=90)(?&matched)([\)\}\]”›»〠‰ã=80=
‹ã€ã€=8F]|$) |
> (ã€=88)(?&matched)([\)\}\]”›»〠‘ã=80=
‹ã€ã€=8F]|$) |
> (ã€=8A)(?&matched)([\)\}\]”›»〠‘ã=80=
‰ã€ã€=8F]|$) |
> (ã€=8C)(?&matched)([\)\}\]”›»〠‘ã=80=
‰ã€‹ã€=8F]|$) |
> (ã€=8E)(?&matched)([\)\}\]”›»〠‘ã=80=
‰ã€‹ã€=8D]|$) |
> (^)(?&matched)([\)\}\]”›»】ã=8 0‰ã=80=
‹ã€ã€=8F]))
> (?(DEFINE)(?(?:
> \((?&matched)\) |
> \{(?&matched)\} |
> \[(?&matched)\] |
> â€=9C(?&matched)â€=9D |
> â€=B9(?&matched)â€=BA |
> «(?&matched)» |
> ã€=90(?&matched)ã€=91 |
> ã€=88(?&matched)ã€=89 |
> ã€=8A(?&matched)ã€=8B |
> ã€=8C(?&matched)ã€=8D |
> ã€=8E(?&matched)ã€=8F |
> [^\(\{\[“‹«【〈ã€=8A= E3€Œ=
ã€=8E\)\}\]”›»】〉=E3 €‹ã€=8D=
ã€=8F]++)*+))
> /sx;
>
> sub check_file {
> if(-f && /\.txt$/) {
> if(open(my $fh,'<:encoding(UTF-8)',$_)) {
> undef $/;
> my $data =3D <$fh>;
> if($data =3D~ $checkre) {
> if(!length $2) {
> print "File $File::Find::name has unclosed bracket $1 =
at
> position $-[1]\n";
> }
> elsif(!length $1) {
> print "File $File::Find::name has unopened bracket $2 =
at
> position $-[2]\n";
> }
> else {
> print "File $File::Find::name has mismatched brackets =
$1
> $2 at positions $-[1] and $-[2]\n";
> }
> }
> } else {
> print STDERR "Cannot open $File::Find::name: $!\n";
> }
> }
> }
>
> @ARGV =3D ('.') unless @ARGV;
> find(\&check_file,@ARGV);
>

--00248c0eefd848c73a04a931f9c2--