diff --git a/CHANGELOG.md b/CHANGELOG.md index 22962ff584..312af25841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - `WakuMessage.payloadAsUtf8` returning garbage on utf-8 non-ascii characters. +- `ChatMessage.payloadAsUtf8` returning garbage on utf-8 non-ascii characters. ## [0.9.0] - 2021-07-26 diff --git a/src/lib/chat_message/index.ts b/src/lib/chat_message/index.ts index 04e3389d17..2ebceb1f68 100644 --- a/src/lib/chat_message/index.ts +++ b/src/lib/chat_message/index.ts @@ -60,10 +60,6 @@ export class ChatMessage { return ''; } - return Array.from(this.proto.payload) - .map((char) => { - return String.fromCharCode(char); - }) - .join(''); + return Buffer.from(this.proto.payload).toString('utf-8'); } }