RosettaCodeData/Task/UTF-8-encode-and-decode/Langur/utf-8-encode-and-decode.langur

9 lines
273 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
writeln "character Unicode UTF-8 encoding (hex)"
2024-07-13 15:19:22 -07:00
for cp in "AöЖ€𝄞" {
val utf8 = cp -> cp2s -> s2b
val cpstr = utf8 -> b2s
2026-04-30 12:34:36 -04:00
val utf8rep = join(map(utf8, by=fn(b) { "{{b:X02}}" }), delim=" ")
2024-07-13 15:19:22 -07:00
writeln "{{cpstr:-11}} U+{{cp:X04:-8}} {{utf8rep}}"
2023-07-01 11:58:00 -04:00
}