This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
buffer.toString() not working correctly #8859
Comments
Buffer checks the encoding with
If anything, I'd call it a documentation error, rather than a proper bug. |
so maybe it should be fixed in docs :) |
While the docs could likely be a bit clearer, looking it over now the error you're getting appears to be the correct behavior. toString is working as it is supposed to. |
Closed
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Dec 16, 2014
(there's an alternate proposed fix here: https://github.com/zetxx/node/commit/c691bf340effde7974e25e3be2aa409bf14 c2012)
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Dec 16, 2014
This reverts commit 8360257.
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Dec 16, 2014
Closed
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Dec 17, 2014
Improve documentation for buffer.toString and buffer.copy per issues nodejs#8859 and nodejs#8857.
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Dec 19, 2014
Improvements to document for buffer.toString and buffer.copy per issues nodejs#8859 and nodejs#8857 (rebased and on joyent/v0.10 and improved slightly)
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Jan 5, 2015
Better wording for start and end parameters, also document .length should be considered readonly. RE: nodejs#8857, nodejs#8859, nodejs#8913 PR: nodejs#8910 PR-URL: nodejs#8910 Signed-off-by: Timothy J Fontaine <[email protected]>
jasnell
added a commit
to jasnell/node-joyent
that referenced
this issue
Jan 5, 2015
Better wording for start and end parameters, also document .length should be considered readonly. RE: nodejs#8857, nodejs#8859, nodejs#8913 PR: nodejs#8910 PR-URL: nodejs#8910 Signed-off-by: Timothy J Fontaine <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there,
following your example on: http://nodejs.org/api/buffer.html#buffer_buf_write_string_offset_length_encoding im trying to make buffer.toString() as follows
buf = new Buffer(256); len = buf.write('\u00bd + \u00bc = \u00be', 0); buf.toString('utf8', 0, len); buf.toString(0, len); buf.toString(undefined, 1, len);
it works as expected but when i try to do following:
buf.toString(1, len);
it ends with error TypeError: Unknown encoding: 1
The text was updated successfully, but these errors were encountered: