Skip to content

Opening files in Binary mode

March 16, 2011

I was trying to copy data from a S3Object to another file, and I would get this error:

ruby-1.9.2-p136 :021 > file << img.valueEncoding::UndefinedConversionError: “\xFF” from ASCII-8BIT to UTF-8

So the local file I had opened was opened in UTF-8 mode and the S3Object apparently was giving me data in binary.

So I opened it in the binary mode the command I used for that is, “w+b”)

the b stands for binary.

This blog entry helped me


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: