2019-09-02 Fred Gleason <fredg@paravelsystems.com>

* Modified the 'pypad' module so as not to throw a
	'UnicodeDecodeError' exception when processing a PAD update
	containing an invalid UTF-8 character.
This commit is contained in:
Fred Gleason 2019-09-02 11:46:59 -04:00
parent 1b70e21d0e
commit a6c1361d43
2 changed files with 7 additions and 2 deletions

View File

@ -19080,3 +19080,7 @@
2019-09-02 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in the 'pypad' module that caused the DB connection
to be opened in 'latin1' mode.
2019-09-02 Fred Gleason <fredg@paravelsystems.com>
* Modified the 'pypad' module so as not to throw a
'UnicodeDecodeError' exception when processing a PAD update
containing an invalid UTF-8 character.

View File

@ -908,8 +908,9 @@ class Receiver(object):
c=sock.recv(1)
line+=c
if c[0]==10:
msg+=line.decode('utf-8')
if line.decode('utf-8')=="\r\n":
linebytes=line.decode('utf-8','replace')
msg+=linebytes
if linebytes=='\r\n':
self.__pypad_Process(Update(json.loads(msg),self.__config_parser,rd_config))
msg=""
line=bytes()