In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Nntp.Perl.Org) writes:
>Hi
>
>How do I check whether a file is in ebcdic or ascii format ?

It rather depends on what you mean by 'ASCII'.  If you were referring
to strict ASCII, the 8th bit would be clear and so, assuming you are
talking about text files, you would look to see whether the 8th bit
was used much, because most printable characters in EBCDIC have the
8th bit set.

However, the picture is a bit muddied by the fact that there are 
character set extensions to ASCII that set the 8th bit.  So the
mere presence of a set 8th bit doesn't rule out ASCII.  

I suggest you do some tests on samples of the kinds of files you'll
be dealing with and print out the percentage of characters they
contain that has the 8th bit set, and look at the ASCII vs EBCDIC
ones.  Hopefully a clear pattern will emerge.

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http//www.perlmedic.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to