Closed edouard-lopez closed 7 years ago
mirror: bestiejs/punycode.js#65
I'm trying to generate glyphs based on a file containing a list of unicode codepoint from U+3400 to U+2B6F8:
U+3400
U+2B6F8
U+3400 qiū … U+2B6F8 tí
convertToJson: (filepath, options) => String(fs.readFileSync(filepath)).split("\n").map(line => { const [codepoint, ruby] = line.split(options.separator); const unicodeCodepoint = codepoint.split("+")[1]; const hexCodepoint = parseInt(unicodeCodepoint, 16); let glyph = punycode.ucs2.encode([hexCodepoint]); console.log(codepoint, hexCodepoint, glyph); return { codepoint, ruby, glyph }; }),
6: convertToJson: (filepath, options) => 7: String(fs.readFileSync(filepath)).split("\n").map(line => { 8: const [codepoint, ruby] = line.split(options.separator); Error: Invalid code point NaN Object.convertToJson (src/dataminer.js:7:51) Test.fn (test/dataminer.test.js:26:20)
I can't find the problem, is it a character or my approach?
mirror: bestiejs/punycode.js#65
I'm trying to generate glyphs based on a file containing a list of unicode codepoint from
U+3400
toU+2B6F8
:Code
Error
Question
I can't find the problem, is it a character or my approach?