textutil help

Hello,
sometimes I’m getting strange results using a shell with textutil to convert specific text files (.txt) into a .doc files. I say “specific” files, because among 70 files undergoing the same process, only three files get marred. Here is the snippet:

dim f as FolderItem = GetOpenFolderItem("")
if f <> nil then
dim temp as FolderItem = SpecialFolder.Desktop.Child(“output file.doc”)
dim sh as shell
sh = new shell
sh.Execute "textutil -convert doc " + f.shellPath
//MsgBox sh.Result
end if

What I get after conversion is this:
/Users/carlorubini/Desktop/Screen Shot 2015-11-25 at 11.09.26 AM.png

Sorry for the previous unfinished conversation:

Hello,
sometimes I’m getting strange results using a shell with textutil to convert specific text files (.txt) into a .doc files. I say “specific” files, because among 70 files undergoing the same process, only three files get marred. Here is the snippet:

dim f as FolderItem = GetOpenFolderItem("")
if f <> nil then
dim temp as FolderItem = SpecialFolder.Desktop.Child(“output file.doc”)
dim sh as shell
sh = new shell
sh.Execute "textutil -convert doc " + f.shellPath
//MsgBox sh.Result
end if

What I get after conversion is a file containing a few funny characters.
Now, I noticed that, if I remove about 20 lines from the file, or add some 50 lines to the file, then I get the right output!
BTW: the same files converted to docx, rtf etc. are perfect.

A Xojo project file with one of the culprit files (in Bengali) can be downloaded at
here

Suggestions welcome. Thanks,
Carlo