UTF-8 encode and decode: Difference between revisions

Content added Content deleted
 
Line 3,323: Line 3,323:
val .utf8 = s2b cp2s .cp
val .utf8 = s2b cp2s .cp
val .cpstr = b2s .utf8
val .cpstr = b2s .utf8
val .utf8rep = join " ", map fn(.b) { $"\.b:X02;" }, .utf8
val .utf8rep = join " ", map fn .b: "{{.b:X02}}", .utf8
writeln $"\.cpstr:-11; U+\.cp:X04:-8; \.utf8rep;"
writeln "{{.cpstr:-11}} U+{{.cp:X04:-8}} {{.utf8rep}}"
}
}</syntaxhighlight>
</syntaxhighlight>


{{out}}
{{out}}