diff --git a/src/node.h b/src/node.h index 74403a6e48d3b8..2e5c9940b0e6bc 100644 --- a/src/node.h +++ b/src/node.h @@ -413,7 +413,8 @@ NODE_EXTERN v8::Local Encode(v8::Isolate* isolate, size_t len, enum encoding encoding = LATIN1); -// The input buffer should be in host endianness. +// Warning: This reverses endianness on Big Endian platforms, even though the +// signature using uint16_t implies that it should not. NODE_EXTERN v8::Local Encode(v8::Isolate* isolate, const uint16_t* buf, size_t len); diff --git a/src/string_bytes.h b/src/string_bytes.h index 5f5fcd9fa0f05e..1f63ad3599dfe8 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -100,7 +100,10 @@ class StringBytes { enum encoding encoding, v8::Local* error); - // The input buffer should be in host endianness. + // Warning: This reverses endianness on BE platforms, even though the + // signature using uint16_t implies that it should not. + // However, the brokenness is already public API and can't therefore + // be changed easily. static v8::MaybeLocal Encode(v8::Isolate* isolate, const uint16_t* buf, size_t buflen,