Created
April 6, 2010 00:35
-
-
Save horatio-sans-serif/357054 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bytes written to buffer: 12 | |
AssertionError: "\u00f6\u65e5\u672c\u8a9e" == "\u00f6\u65e5\u672c\u8a9e\u0000" | |
at Object.<anonymous> (/tmp/utf8slice.js:10:8) | |
at Module._compile (node.js:704:23) | |
at node.js:732:20 | |
at fs:51:23 | |
at node.js:813:9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assert = require("assert"); | |
sys = require("sys"); | |
Buffer = require("buffer").Buffer; | |
var testValue = '\u00F6\u65E5\u672C\u8A9E'; // ö日本語 | |
var buffer = new Buffer(32); | |
var size = buffer.utf8Write(testValue, 0); | |
sys.puts('bytes written to buffer: ' + size); | |
var slice = buffer.utf8Slice(0, size); | |
assert.equal(slice, testValue); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment