diff --git a/ChangeLog b/ChangeLog index 5642137c..581e53a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19080,3 +19080,7 @@ 2019-09-02 Fred Gleason * Fixed a bug in the 'pypad' module that caused the DB connection to be opened in 'latin1' mode. +2019-09-02 Fred Gleason + * Modified the 'pypad' module so as not to throw a + 'UnicodeDecodeError' exception when processing a PAD update + containing an invalid UTF-8 character. diff --git a/apis/pypad/api/pypad.py b/apis/pypad/api/pypad.py index 1835f190..b6a5bdd7 100644 --- a/apis/pypad/api/pypad.py +++ b/apis/pypad/api/pypad.py @@ -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()