RosettaCodeData/Task/UTF-8-encode-and-decode/8th/utf-8-encode-and-decode.8th

36 lines
434 B
Plaintext

hex \ so bytes print nicely
[
"\u0041",
"\u00F6",
"\u0416",
"\u20AC"
]
\ add the 0x1D11E one; the '\u' string notation requires four hex digits
"" 1D11E s:+ a:push
\ for each test, print it out and its bytes:
(
dup . space
b:new
( . space drop ) b:each
cr
) a:each! drop
cr
\ now the inverse:
[
[41],
[C3,B6],
[D0,96],
[E2,82,AC],
[$F0,9D,84,9E]
]
(
dup . space
b:new >s . cr
) a:each! drop
bye