Fixed `ChatMessage.payloadAsUtf8` returning garbage on utf-8 non-ascii

This commit is contained in:
Franck Royer 2021-08-02 10:36:50 +10:00
parent 1f692f1683
commit 45dc8f81c9
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 2 additions and 5 deletions

View File

@ -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

View File

@ -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');
}
}