Sending the following message (please note that the second character in the MSH-2 is elevated and not a correct tilde (~) ):
MSH|^˜\&|PAMSimulator|IHE|PAMSimulator|IHE|20111219123224||ADT^A01^ADT_A01|20111219123224|P|2.5||||||UNICODE UTF-8
EVN||20111219123224||||20111219123224
PID|||DDS-31223^^^DDS&1.3.6.1.4.1.12559.11.1.4.1.2&ISO^PI||Kiefer^Gisela^^^^^L|Endres^^^^^^M|19351005041238|F|||&Uhlandstraße^^Marbach am Neckar^^71726^DEU||||||||||||||||||||N
PV1||I|1W^314^1^ITALIAN_HOSPITAL||||LOPEZ^GABRIELLA^^^DR|PRUST^RALPH^^^DR|||||||||||28^^^IHEPAM&1.3.6.1.4.1.12559.11.1.2.2.5&ISO^VN|||||||||||||||||||||||||20111219123200
- results in the following exception with trace:
2012-01-24 09:18:48,268 WARN (ca.uhn.hl7v2.llp.ExtendedMinLLPReader.java:117) - Nonvalid charset - defaulting to US-ASCII
ca.uhn.hl7v2.HL7Exception: Parse failed
at ca.uhn.hl7v2.preparser.PreParser.getFields(PreParser.java:94)
at ca.uhn.hl7v2.preparser.PreParser.getFields(PreParser.java:69)
at ca.uhn.hl7v2.llp.ExtendedMinLLPReader.getCharacterEncoding(ExtendedMinLLPReader.java:109)
at ca.uhn.hl7v2.llp.ExtendedMinLLPReader.getMessage(ExtendedMinLLPReader.java:152)
at com.cetrea.hapi.extensions.ExtendedMLLPTransport.doReceive(ExtendedMLLPTransport.java:99)
at ca.uhn.hl7v2.protocol.impl.AbstractTransport.receive(AbstractTransport.java:73)
at ca.uhn.hl7v2.protocol.impl.ProcessorImpl.tryReceive(ProcessorImpl.java:246)
at ca.uhn.hl7v2.protocol.impl.ProcessorImpl.cycle(ProcessorImpl.java:266)
at ca.uhn.hl7v2.protocol.impl.ProcessorImpl$Cycler.run(ProcessorImpl.java:512)
at java.lang.Thread.run(Unknown Source)
However - this has nothing to do with it being UNICODE UTF-8, it is because of the the second character in the MSH-2.
The following trace is
2012-01-24 09:20:33,274 ERROR (ca.uhn.hl7v2.protocol.impl.ProcessorImpl$Cycler.java:514) - Error processing message
ca.uhn.hl7v2.HL7Exception: Parse failed
at ca.uhn.hl7v2.preparser.PreParser.getFields(PreParser.java:94)
at ca.uhn.hl7v2.preparser.PreParser.getFields(PreParser.java:69)
at ca.uhn.hl7v2.protocol.impl.ProcessorImpl.cycle(ProcessorImpl.java:285)
at ca.uhn.hl7v2.protocol.impl.ProcessorImpl$Cycler.run(ProcessorImpl.java:512)
at java.lang.Thread.run(Unknown Source)
I suggest a better exception message
BTW: Its in the HAPI 2.0-beta1 it was found
Fix has been checked in with a more descriptive error message. Thanks for reporting!