in reply to Binary output ot browser/force download?

What MIME type are you sending in your headers? You'll need to send the appropriate type to get the browser to behave correctly. You'll also need to send a filename header unless you want the client machine to save the file as the name of your script.