If a data file is supposed to have non-text content (audio, image, compressed data, etc), you should expect to see some 0x0A bytes that are not preceded by 0x0D. But if some jerk passes the file through a "unix2dos" conversion (or a text-mode ftp transfer to a Windows machine, which amounts to the same thing), every 0x0A (ascii LF) will be preceded by 0x0D (ascii CR). Here's a little test to check that out.
#!/usr/bin/perl
use strict;
die "$0 file2chk\n" unless @ARGV == 1 and -f $ARGV[0];
$/ = "\x0a"; # make sure we're "platform independent"!
open( I, $ARGV[0] ) or die "$ARGV[0]: $!";
my $crlf;
while (<I>) {
if ( "\x0a" ne chop ) { # $. is incremented for the last record,
$.--; # even when the file does not end with \x
+0a
} elsif ( "\x0d" eq chop ) {
$crlf++;
}
}
print "$ARGV[0] : $. \\x0A, $crlf CRLF\n";
The point is that if you run this on something like a *.wav or *.gz or *.zip file, etc, and the number of times you see "0x0A" is exactly equal to the number of times you see "CRLF", then it's extremely likely that this file has gone through a unix2dos conversion -- which would explain why playback has those annoying clicks, or why uncompression won't work, etc. -- and you should probably just delete it (don't even try to fix it).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.