I tried $string =! m/[^\x20-\x7E]/ and it did not work so using m/.../
as a hint I looked up regular expression. I found information on the
Unicode uft8 module. I constructed the script below.

use utf8;              # We will be doing Unicode processing
use charnames ":full"; # use named chars with Unicode full names

while ( <> ) {
    chop();
    if (  /\P{IsPrint}/  ) {
       print "$_\n";
    }
}

When I ran it I got the following errors:
C:\My Download Files>perl tvt.pl navgw20011210 > tvt.out
Malformed UTF-8 character (unexpected non-continuation byte 0xc3 after start
byt
e 0xc8) in pattern match (m//) at tvt.pl line 10, <> line 952.
.....
e 0xc5) in pattern match (m//) at tvt.pl line 10, <> line 952.
Malformed UTF-8 character (unexpected non-continuation byte 0xcd after start
byt
e 0xcb) in pattern match (m//) at tvt.pl line 10, <> line 3840.
Malformed UTF-8 character (unexpected non-continuation byte 0x70 after start
byt
e 0xe9) in pattern match (m//) at tvt.pl line 10, <> line 13133.
Malformed UTF-8 character (unexpected non-continuation byte 0x71 after start
byt
e 0xe9) in pattern match (m//) at tvt.pl line 10, <> line 13133.
....
Malformed UTF-8 character (unexpected non-continuation byte 0xc0 after start
byt
e 0xc3) in pattern match (m//) at tvt.pl line 10, <> line 47963.
Malformed UTF-8 character (unexpected non-continuation byte 0xc4 after start
byt
e 0x1fd) in pattern match (m//) at tvt.pl line 10, <> line 47963.
.....
Looking at documentation I found:

    $x = "\N{MERCURY}";  # two-byte Unicode character
    $x =~ /\C/;  # matches, but dangerous!
The last regexp matches, but is dangerous because the string character
position is no longer synchronized to the string byte position. This
generates the warning 'Malformed UTF-8 character'. \C is best used for
matching the binary data in strings with binary data intermixed with Unicode
characters.
Other than spliting every line into an octets and  checking if  ( $octet >
0x20 and $octet < 0x53)  are there any other
solutions?































_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to