robotpy / pynetworktables

Pure python implementation of the FRC NetworkTables protocol
Other
60 stars 30 forks source link

Gracefully handle invalid UTF-8 strings #62

Closed auscompgeek closed 6 years ago

auscompgeek commented 6 years ago

From discussion on Gitter:

<virtuald> I'm not really sure what pynetworktables should do in this
           case though
<virtuald> Peter thinks we should just gracefully handle it
<virtuald> any chance you can put together a PR that catches invalid
           string decodes and replaces the string with
           'INVALID UTF-8: <repr of bytes>'
<virtuald> ... that will probably crash his robot though if the string
           ever gets sent to the robot
<auscompgeek> yeah... stuck between a rock and a hard place here
<virtuald> so, java et al will do the same thing
<virtuald> so
<virtuald> I think that's what we have to do
<virtuald> and if it's an important string, the robot will crash
<virtuald> but at least in our case, we'll add in a note saying it's
           invalid
<virtuald> whereas with java et al, it'll just be a random set of
           characters that don't make sense

Fixes #61