$pubdef htou htoi itou $pubdef utoh utoi itoh $pubdef fcolor { 27 itoc "[38;5;" 4 rotate "m" }cat $pubdef fbackground { 27 itoc "[48;5;" 4 rotate "m" }cat : itou[ i:char -- s:unicode ] { char @ 128 < if itoc else char @ 2048 < if char @ 64 % 128 + itoc char @ -6 bitshift char ! char @ 32 % 192 + itoc else char @ 65536 < if char @ 64 % 128 + itoc char @ -6 bitshift char ! char @ 64 % 128 + itoc char @ -6 bitshift char ! char @ 16 % 224 + itoc else char @ 262144 < if char @ 64 % 128 + itoc char @ -6 bitshift char ! char @ 64 % 128 + itoc char @ -6 bitshift char ! char @ 64 % 128 + itoc char @ -6 bitshift char ! char @ 8 % 240 + itoc else "" then then then then }array array_reverse array_interpret ; PUBLIC itou $libdef itou : utoi[ s:unicode -- i:char ] var tmp unicode @ 1 1 midstr ctoi var! tmp tmp @ 192 < if unicode @ 1 1 midstr ctoi 192 % else tmp @ 224 < if unicode @ 1 1 midstr ctoi 32 % 64 * unicode @ 2 1 midstr ctoi 64 % + else tmp @ 240 < if unicode @ 1 1 midstr ctoi 16 % 4096 * unicode @ 2 1 midstr ctoi 64 % 64 * + unicode @ 3 1 midstr ctoi 64 % + else tmp @ 248 < if unicode @ 1 1 midstr ctoi 8 % 262144 * unicode @ 2 1 midstr ctoi 64 % 4096 * + unicode @ 3 1 midstr ctoi 64 % 64 * + unicode @ 4 1 midstr ctoi 64 % + else 0 then then then then ; PUBLIC utoi $libdef utoi