Does anyone know of a way to know if the content of a file on the IFS is EBCDIC or ASCII? I know that I can assume that if the CCSID isn't 819 that is probably isn't EBCDIC. However, if the CCSID is 819 it can contain either. I cannot find an easy way to know if the content is EBCDIC or ASCII.
Here is what I am trying to do. I have to change our email program to alway encode attachments using base64. If I encode a file that contains EBCDIC data it is garbage when the email client decodes it. I have to first convert the data to ASCII before I encode it. If the file that I am attaching contains ASCII data it works great if I do not convert it to ASCII. I need to know when to convert EBCDIC to ASCII and there really isn't anything that tells me that file 'XYZ' contains ASCII data or EBCDIC data.
Does anyone have any ideas? I am thinking I could write a program that decides if a file is ASCII using discrimination. That is, read some number of characters from the file and if some percentage of those characters are not the typical characters used then make an assumption.