Wednesday, October 19, 2011

Gmail Binary File Attachment Bug and Its Fix

If you're attaching a binary file to an email bound to a Gmail account or if you're attaching a binary file to an email outgoing from a Gmail account, be very careful. If your binary file contains the 0Dh, 0Ah byte sequence, Gmail very probably would treat it as text attachment instead of binary attachment which will result in Gmail truncating/deleting the 0Dh byte.

This is bug really annoying, especially if the file requires a "binary precision", it will become unusable. The fix is quite easy, just make Gmail unable to "peek" into the attachment by compressing the file with Winrar or other file compressor. A side note: WinZip or other Zip compressor still enables Gmail to "peek" into your attachment(s).