Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update buffer.md #29792

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ The character encodings currently supported by Node.js include:

* `'binary'` - Alias for `'latin1'`.

* `'hex'` - Encode each byte as two hexadecimal characters.
* `'hex'` - Encode each byte as two hexadecimal characters. If the number of
hexadecimal characters is odd, the first incomplete hexadecimal pair is ignored.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hexadecimal characters is odd, the first incomplete hexadecimal pair is ignored.
hexadecimal characters is odd, the last character is ignored.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be better moving it down into it's own one line paragraph with a simple example

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move it to its own paragraph, we can also add information (if it's not already there) about what happens if the string contains characters that are not hexadecimal (e.g., '1a7g'). That can also be in a separate PR, but wouldn't be out of place in this one!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott "hexadecimal characters is odd, the last character is ignored." adding this line is enough ?


Modern Web browsers follow the [WHATWG Encoding Standard][] which aliases
both `'latin1'` and `'ISO-8859-1'` to `'win-1252'`. This means that while doing
Expand Down