Move message sanitizer consistently to the client (fixes #49)