The line `t = t.encode("utf8")` returns a bytes object which does not make sense in the context of the rest of the code. It is probably a copy-paste error.
To test the bug:
1. open the file attached to this forum post: https://forum.freecad.org/viewtopic.php?t=89012#p770224
2. Make the rectangles visible.
3. Start the Survey command and box select all objects in the 3D view.