Hi Jeff,
Well, I have tried this too => fconfigure -encoding binary, I saw this has been used in one of the files in core. What I am thinking is that this looks a file writting problem with a Blob data. When I tried the same code for plain/text, it worked.
Thanks again and let me know if anything else comes up in your mind.
regards
Anjani