Clear trailing whitespace
Fix decodeUtf8 uncaught exception

Use decodeUtf8' instead