Skip to content

Commit 5475378

Browse files
authored
docs(NODE-4349): add note about Binary(string) behavior (#504)
1 parent 9613021 commit 5475378

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/binary.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ export class Binary {
6262
position!: number;
6363

6464
/**
65+
* Create a new Binary instance.
66+
*
67+
* This constructor can accept a string as its first argument. In this case,
68+
* this string will be encoded using ISO-8859-1, **not** using UTF-8.
69+
* This is almost certainly not what you want. Use `new Binary(Buffer.from(string))`
70+
* instead to convert the string to a Buffer using UTF-8 first.
71+
*
6572
* @param buffer - a buffer object containing the binary data.
6673
* @param subType - the option binary type.
6774
*/

0 commit comments

Comments
 (0)