We are trying to decode some uuencoded PDF files that are embedded in a txt file.
The problem we have is that most of the PDF files decoded just fine using Python's uuencode library. Here is the code:
try:
decoded_file,m=uudecode(fileString)
except:
decoded_file=''
However, some of the files cannot be opened after they are decoded. We receive the message "There was an error opening this document. The file is damaged and could not be repaired."
The only thing we could find on Google is that our files could've been encoded using base64 and the Python uuencoding module only supports base32. Is there a way that we could tell whether it was uuencoded using base64 or base32?
Here is an example of a txt file that had an embedded uuencoded pdf that we successfully decoded: http://www.sec.gov/Archives/edgar/data/1108046/000000000011020832/0000000000-11-020832.txt
And here is an example of one that failed: http://www.sec.gov/Archives/edgar/data/914257/000000000011005978/0000000000-11-005978.txt
While we are decoding these in Python no errors pop up of any kind and everything seems to be working as it should. What could be causing them to not decode properly? Is there a way we could flag this while we are processing them?