web stats
Removing Illegal Characters in the MSH - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 12-16-2015, 12:29 PM
atibbits atibbits is offline
Mirth Guru
Join Date: May 2012
Location: Salina, KS
Posts: 381
atibbits is on a distinguished road
Thumbs down Removing Illegal Characters in the MSH

How can I remove some illegal characters that are showing up at the beginning of a MSH segment? They are non-ASCII characters and I think they are hexadecimal EF, BB, and BF. I am pretty sure I need to do this in the pre-processor, but I cannot figure out how to do that. I have tried to replace the characters with null, but that is not working. Here is what I am getting:

I highlighted the illegal characters I would like to remove in red. Any suggestions are greatly appreciated!!!!!!

Reply With Quote
Old 12-16-2015, 01:00 PM
narupley's Avatar
narupley narupley is offline
Mirth Employee
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road

Looks like an XML BOM to me. You should be able to remove it in the preprocessor script:

return message.replace(/\uFEFF/g,'');
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

- How do I foo?
- You just bar.
Reply With Quote
Old 12-16-2015, 01:56 PM
rmcwilli rmcwilli is offline
What's HL7?
Join Date: Feb 2012
Posts: 2
rmcwilli is on a distinguished road

We got it working by placing the following in the pre-processor:

return message.substring(3);

The messages were a predictable length of 3 character preceding the message.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 03:54 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation