Skip to content
Browse files

Do not senselessly force byte string from file into unicode.

Failed whenever file contained high-order cp1252 characters.
  • Loading branch information...
1 parent 222e04e commit c0cb12e62ea318f30d7ba7c9b4c6a1264291cd2d @johnpaulett committed Mar 14, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 hl7/client.py
View
6 hl7/client.py
@@ -1,5 +1,6 @@
from optparse import OptionParser
+import hl7
import os.path
import socket
import sys
@@ -51,9 +52,10 @@ def send_message(self, message):
"""Wraps a str, unicode, or :py:cls:`hl7.Message` in a MLLP container
and send the message to the server
"""
+ if isinstance(message, hl7.Message):
+ message = unicode(message)
# wrap in MLLP message container
- data = SB + unicode(message) + EB + CR
- # TODO consider encoding (e.g. UTF-8)
+ data = SB + message + EB + CR
return self.send(data)
def send(self, data):

0 comments on commit c0cb12e

Please sign in to comment.
Something went wrong with that request. Please try again.