You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var length = 256;
var buf = new Buffer(length);
for (var i = 0; i < length; ++i) {
buf[i] = i;
}
var string = buf.toString();
for(var i = 0; i < string.length; i++) {
console.log("i",i, string[i], string.charCodeAt(i));
}
results in the following output:
i 123 { 123
i 124 | 124
i 125 } 125
i 126 ~ 126
i 127 ⌂ 127
i 128 ? 65533
i 129 ? 65533
i 130 ? 65533
i 131 ? 65533
i 132 ? 65533
I cannot quite get my head around the fact, that the charCodeAt() suddenly changes from 127 to 65533. I also took a look at the source code of buffer.js and node_buffer.cc, but could not find code that explains this behaviour. Is this behavior intended? If so, could someone explain why?
The text was updated successfully, but these errors were encountered:
I'm closing this because it's not a technical issue with node.
If you have more questions, you are welcome to ask them in https://github.com/nodejs/help/issues
results in the following output:
I cannot quite get my head around the fact, that the
charCodeAt()
suddenly changes from 127 to 65533. I also took a look at the source code ofbuffer.js
andnode_buffer.cc
, but could not find code that explains this behaviour. Is this behavior intended? If so, could someone explain why?The text was updated successfully, but these errors were encountered: