web stats
Escape characters generating error in OBX - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2019, 09:47 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default Escape characters generating error in OBX

I have a vendor sending RTF results which include the escape characters for the backslash, \E\.

We appear to be failing the messages due to the escape characters. I manually replaced these characters with the backslash and the message no longer errored. However, our downstream vendor needs the escape characters.

The error reads: TypeError: The content of elements must consist of well-formed character data or markup.



What would be causing our inbound interface to fail messages which include the \E\ values? Being standard, I expect that to not be a problem.

I suppose I can try to find a way to transform the \ to \E\, but that would also require having the source vendor change what they're sending in the first place. Would be best to realize why we are erroring when receiving \E\
Reply With Quote
  #2  
Old 12-11-2019, 10:51 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 254
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Could you store the RTF data as an attachment, and then re-attach when sending? That way you are never trying to parse the \E\ ?
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #3  
Old 12-11-2019, 11:18 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,100
agermano is on a distinguished road
Default

Quote:
Originally Posted by jackwhaines View Post
Could you store the RTF data as an attachment, and then re-attach when sending? That way you are never trying to parse the \E\ ?
That's good advice in general, but I'd also be interested to know what is causing the error. There shouldn't be any issues with passing it through.
Reply With Quote
  #4  
Old 12-11-2019, 11:21 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

preprocessor script...

msg = msg.replaceAll('\\E\\', '\\\\');//I think that is the correct number of \s


postprocessor script...

msg = msg.replaceAll('\\\\', '\\E\\');
Reply With Quote
  #5  
Old 12-11-2019, 11:44 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
preprocessor script...

msg = msg.replaceAll('\\E\\', '\\\\');//I think that is the correct number of \s


postprocessor script...

msg = msg.replaceAll('\\\\', '\\E\\');
It's telling me "ReferenceError: "msg" is not defined". I tried with and without "return message;" after each of those scripts andgot the same error.
Reply With Quote
  #6  
Old 12-11-2019, 11:47 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by jackwhaines View Post
Could you store the RTF data as an attachment, and then re-attach when sending? That way you are never trying to parse the \E\ ?
Our channel has "Store Attachment" checked off, but nothing beyond that. The attachment drop-down is set to "None". I have never worked with this feature and am unsure how to go about doing what you said.
Reply With Quote
  #7  
Old 12-11-2019, 12:02 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

change msg to message.
Reply With Quote
  #8  
Old 12-11-2019, 12:07 PM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
change msg to message.
TypeError: cannot find function replaceAll in object (message pasted here)


This is what I have now:


preprocessor script...

message = message.replaceAll('\\E\\', '\\\\');

postprocessor script...

message = message.replaceAll('\\\\', '\\E\\');
Reply With Quote
  #9  
Old 12-11-2019, 12:11 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

put this as your first line...

message = java.lang.String(message);//converts the javascript string to a java string;

and your return line to....

return String(message);//convert back to a javascript string.
Reply With Quote
  #10  
Old 12-11-2019, 12:14 PM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
put this as your first line...

message = java.lang.String(message);//converts the javascript string to a java string;

and your return line to....

return String(message);//convert back to a javascript string.
THis is just the pre-processor at this point, right? Do I keep the message = message.replaceAll('\\E\\', '\\\\');
line?
Reply With Quote
Reply

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 02:38 PM.


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