fix issue with logging non utf8 chars

fixes https://github.com/owncloud/core/issues/5956

please review @DeepDiver1975 @PVince81 @tanghus