Skip to content

Commit 16b0278

Browse files
committed
DCSToolkit integration #5 fix the encoding for messages created, \n\r
and octal encoded chars \777
1 parent a24832d commit 16b0278

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

opendcs-acquisition/config/sr3/plugins/dcpflow.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,13 @@ def gather(self):
332332
logger.error( f"{str(cmd).replace(lsu.password,'password')}: failed")
333333
return []
334334

335-
rof=open(rawObsFile,'r')
335+
rof=open(rawObsFile,'rb')
336336
FirstLine=False
337337
bf=None
338338
messages=[]
339339
RxTime=datetime.datetime.now(datetime.timezone.utc)
340-
for raw_line in rof.readlines():
340+
for byte_line in rof.readlines():
341+
raw_line = byte_line.decode('unicode-escape')
341342
if raw_line.startswith("TTAAii"):
342343
FirstLine=True
343344
if bf:
@@ -373,7 +374,10 @@ def gather(self):
373374
except Exception as ex:
374375
logger.error( "problem reading ob", exc_info=True )
375376
continue
376-
bf.write(raw_line)
377+
for l in raw_line.split('\\n'):
378+
#l=l.replace('\\r','').replace('\\\\','\\').strip()+'\r\n'
379+
l=l.replace('\\r','').strip()+'\r\n'
380+
bf.write(l)
377381

378382
if bf:
379383
bf.close()

0 commit comments

Comments
 (0)