File tree 2 files changed +2
-19
lines changed
2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ defmodule HL7.Message do
11
11
12
12
`copy: true` -- Will create binary copies while parsing to avoid keeping references.
13
13
`validate_string: true` -- Will generate an `HL7.InvalidMessage` if the source text is not UTF-8 compatible.
14
- `accept_latin1: true` -- If used with `validate_string: true`, this will take failed validations and attempt to encode any latin1 as UTF-8.
15
- If used without `validate_string: true`, this will always attempt to encode any latin1 as UTF-8.
16
14
"""
17
15
alias HL7.Path
18
16
@@ -510,17 +508,10 @@ defmodule HL7.Message do
510
508
end
511
509
512
510
defp validate_text ( raw_text , options ) do
513
- encoded_text =
514
- if options [ :accept_latin1 ] == true do
515
- :unicode . characters_to_binary ( raw_text , :latin1 )
516
- else
517
- raw_text
518
- end
519
-
520
511
validate_string = options [ :validate_string ] == true
521
512
522
- if ! validate_string or String . valid? ( encoded_text ) do
523
- { :ok , encoded_text }
513
+ if ! validate_string or String . valid? ( raw_text ) do
514
+ { :ok , raw_text }
524
515
else
525
516
% HL7.InvalidMessage {
526
517
raw: raw_text ,
Original file line number Diff line number Diff line change @@ -156,14 +156,6 @@ defmodule HL7MessageTest do
156
156
assert % HL7.InvalidMessage { } = HL7.Message . new ( latin1_msg , % { validate_string: true } )
157
157
end
158
158
159
- test "A message with latin1 data passed into Message.new will result in a valid Message with options `validate_string: true` and `accept_latin1: true`" do
160
- latin1_text = << 220 , 105 , 178 >>
161
- latin1_msg = HL7.Examples . wikipedia_sample_hl7 ( ) |> String . replace ( "A01" , latin1_text )
162
-
163
- assert % HL7.Message { } =
164
- HL7.Message . new ( latin1_msg , % { validate_string: true , accept_latin1: true } )
165
- end
166
-
167
159
test "An incomplete header passed into Message.new will result in InvalidMessage" do
168
160
missing_message_type =
169
161
HL7.Examples . wikipedia_sample_hl7 ( ) |> String . replace ( "ADT^A01^ADT_A01" , "" )
You can’t perform that action at this time.
0 commit comments