Hi. First of all, I am running 5.8.8 on solaris. Also, I do not have the option of downloading modules from cpan (company policy).
I am helping someone who receives about 100Mb of data from another organization. He needs me to identify bad characters in the data.
My initial thought was to use the "ord" function and report the line number and column number of characters < 32 ascii or > 126 ascii. After doing some reading, I am wondering if that was the wrong approach.
It is unknown what encoding this is supposed to be. Some files may be sent in the wrong encoding.
Bottom line: will my approach of < 32 ascii or > 126 ascii work despite the actual encoding sent?
The null characters are in a separate report
while( $line =~ /\G(.)/g ) { my $this_char = $1; ++$char_in_line; my $ascii = ord $this_char; if( ( $ascii < 32 || $ascii > 126 ) && $ascii != 0 ) { ++$total_bad_chars{$ascii}; printf "filename: %s -- line_n: %d -- char_in_line: %4d -- as +cii: %4d\n", $filename, $line_n, $char_in_line, $ascii; } }
I am continuing to read, but I am fairly well confused. Maybe this new concept (for me) will begin to gel.
Thanks, Jim
In reply to unknown encoding by jimw54321
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |