Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
func utf8_encoder(Number code) {
|
||||
code.chr.encode('UTF-8').bytes.map{.chr}
|
||||
}
|
||||
|
||||
func utf8_decoder(Array bytes) {
|
||||
bytes.map{.ord}.decode('UTF-8')
|
||||
}
|
||||
|
||||
for n in ([0x0041, 0x00F6, 0x0416, 0x20AC, 0x1D11E]) {
|
||||
var encoded = utf8_encoder(n)
|
||||
var decoded = utf8_decoder(encoded)
|
||||
assert_eq(n, decoded.ord)
|
||||
say "#{decoded} -> #{encoded}"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue