From 1e790de760e1921fc079f9609e370296fc1d94c4 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Wed, 13 Apr 2022 11:51:20 +0200 Subject: unicode: Properly report unknown codepoints --- modules/unicode/unicode.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/unicode/unicode.js') diff --git a/modules/unicode/unicode.js b/modules/unicode/unicode.js index 113ea83..ee83179 100644 --- a/modules/unicode/unicode.js +++ b/modules/unicode/unicode.js @@ -114,14 +114,18 @@ module.exports = function (app, io, moddir) { app.get("/unicode/lookup/:query", (req, res) => { const codepoints = []; + let notfound = ""; for (let codepoint of req.params.query) { codepoint = codepoint.codePointAt(0); - codepoints.push(lookupCode(codepoint)); + const result = lookupCode(codepoint); + if (result != null) codepoints.push(result); + else notfound += String.fromCodePoint(codepoint); } res.json({ index: recogniseIndex(req.params.query) || undefined, codepoints: codepoints, + notfound: notfound, search: searchDescription(req.params.query), }); }); -- cgit v1.2.3-54-g00ecf