UTF-8 encode and decode: Difference between revisions

Content added Content deleted
(Added Julia language)
Line 687:
π„ž U+01d11e [f0,9d,84,9e] [f0,9d,84,9e] [f0,9d,84,9e] U+01d11e
</pre>Note that the misalign there on the last line is caused by the string length of astral characters being 2 so the padding functions break.
 
=={{header|Julia}}==
{{works with|Julia|0.6}}
 
Julia supports by default UTF-8 encoding.
 
<lang julia>for t in ("A", "ΓΆ", "Π–", "€", "π„ž")
enc = Vector{UInt8}(t)
dec = String(enc)
println(dec, " β†’ ", enc)
end</lang>
 
{{out}}
<pre>A β†’ UInt8[0x41]
ΓΆ β†’ UInt8[0xc3, 0xb6]
Π– β†’ UInt8[0xd0, 0x96]
€ β†’ UInt8[0xe2, 0x82, 0xac]
π„ž β†’ UInt8[0xf0, 0x9d, 0x84, 0x9e]</pre>
 
=={{header|Kotlin}}==