It's tricky indeed.
In my case, this is what ended up working best:
-- code that builds the binary blob (this code works for both YottaDB and Iris, so, no $ZChar in there) --
Open file:(newversion:stream:nowrap:nodelimiter:chset="M") Use file
For ii=1:1:$Length(blob) Write *$Ascii(blob,ii)
(And I'm sure I could have used $ZChar($Ascii(blob,ii)) instead of *$Ascii(blob,ii),
but with *$Ascii(blob,ii) the code remains just a tad closer to the standard.)
Thanks for all the help,