It is common to have Base64 encode data in an OBX-5 field. The most common I've come across are PDF documents, but also .Doc, Docx and other Document formats are common, as are the many image formats - TIFF, PNG, JPG, and BMP.
HL7 Soup is now my go-to HL7 integration engine for binary formats as it's just so simple, while at the same time it's totally flexible. Let me show you.
Create a receiver workflow that receives an HL7 message and then writes it out to a file.
In the transformers of the “File Writer” activity, drag the OBX-5 into the transformers list to create a new variable.
Then back in the “File Writer” change the message template to write out the variable (delete the default message template, the right click in message template and insert variable).
Now Just change the message type of the file you want to write to binary and you’ll have a binary file.
And that is it done. Writing out a binary file automatically decodes the value from base64. No mucking about with code or anything fiddly like that.
OK, but what if it wasn’t actually binary data, you just had base64 encoded text for instance? Well, you also have the option to right click on the variable and tell it to base64 decode the value like so.
There are lots of different types of encoding available too. Depending on the Message Type you select, you get different options. E.g. if I had written out an XML document then right-clicking on the variable would allow me to "XML Encode" the data which replaces the &'s & etc.