summaryrefslogtreecommitdiff
path: root/macros/unicodetex/latex/emotion/emotion.lua
blob: bde272c2b58c2a3b714314c3326f2399b3d9473a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function unicodes(chs)
    local text = ""
    for _, c in utf8.codes(chs) do
        text = text .. unicode(c)
    end
    print(text)
end

function unicode(codepoint)
    local value = NULL
    if codepoint > 0xFFFF then
        value = string.format("^^^^^^%06x", codepoint)
    elseif codepoint > 0xFF then
        value = string.format("^^^^%04x", codepoint)
    else
        value = string.format("^^%02x", codepoint)
    end
    return value
end

unicodes("🀁♀")