Anonymous user
Module:Unicode data: Difference between revisions
Split noncharacter per request
(Per edit request) |
(Split noncharacter per request) |
||
Line 126: | Line 126: | ||
--]] | --]] | ||
function p.is_noncharacter(codepoint) | |||
function p. | |||
-- U+FDD0-U+FDEF and all code points ending in FFFE or FFFF are Unassigned | -- U+FDD0-U+FDEF and all code points ending in FFFE or FFFF are Unassigned | ||
-- (Cn) and specifically noncharacters: | -- (Cn) and specifically noncharacters: | ||
-- https://www.unicode.org/faq/private_use.html#nonchar4 | -- https://www.unicode.org/faq/private_use.html#nonchar4 | ||
return 0xFDD0 <= codepoint and (codepoint <= 0xFDEF | |||
or floor(codepoint % 0x10000) >= 0xFFFE) then | or floor(codepoint % 0x10000) >= 0xFFFE) | ||
end | |||
-- https://www.unicode.org/versions/Unicode11.0.0/ch04.pdf, section 4.8 | |||
function p.lookup_name(codepoint) | |||
if p.is_noncharacter(codepoint) then | |||
return ("<noncharacter-%04X>"):format(codepoint) | return ("<noncharacter-%04X>"):format(codepoint) | ||
end | end |