Jump to content

UTF-8 encode and decode: Difference between revisions

Added Julia language
(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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.