Thursday, 3 November 2016

Setting the Encoding in HL7 Soup

I’ve been working on an integration to an old HL7 system where all the messages are encoded with ASCII.  This was causing values like µmol/L to show as ?mol/L in HL7 Soup.  It also impacts characters like the copyright © symbol.

OK, so there was a very simple fix – I just had to upgrade to the latest version of HL7 Soup, then everything just started working.  However, in the process, I found out some new encoding features.
You can actually set the encoding that is to be used in the HL7 Soup config file.

Navigate to the HL7 Soup Config file found at
C:\Program Files (x86)\Popokey\HL7 Soup\HL7Soup.exe.config
And copy it to your desktop.

Open it up in notepad and locate the Encoding setting

<setting name="Encoding" serializeAs="String">
    <value>Default</value>
</setting>


The Default option suggests that loading or sending HL7 messages will use the default encoding on the PC, which is most likely ISO-8859-1. I think that the Default will be the best for most users, but the option is still there if you need to force a change.


To change the HL7 message encoding to ASCII
<setting name="Encoding" serializeAs="String">
    <value>ASCII</value>
</setting>



To change the HL7 message encoding to UTF-8
<setting name="Encoding" serializeAs="String">
    <value>UTF-8</value>
</setting>


To change the HL7 message encoding to ISO-8859-1
<setting name="Encoding" serializeAs="String">
    <value>UTF-8</value>
</setting>


There is also DefaultUTF-8 option that loads messages using the default encoding on the PC, but once it is sent it will just use UTF-8. I think that this will come in handy for those that have strict UTF-8 requirements for the sending, but always get sent ISO-8859-1 messages.


Once you have made your changes, save the file and copy it back to C:\Program Files (x86)\Popokey\HL7 Soup\
Overwrite the existing file with this edited version and restart HL7 Soup for the changes to take effect.