I have a bunch of pdf/txt/msg files I'm trying to download in the ruby console and either move to a local directory or re-upload to another destination.
To start, I've just been trying to read the file and write it to a local directory like so:
path = File.join 'temp', doc_name
file = File.new(path, 'w')
file << Document.find(123).fetch_file // this function retrieves and decrypts the file from s3
The exception I get is: Encoding::UndefinedConversionError: "\xB5" from ASCII-8BIT to UTF-8
I'm wondering how I might be able to get the encoding correct on the file write so that I can download it and open it. It seems like it should be trivial, the answer could be in the decryption or s3 call, but this seemed related to the file write.