UTF-8 encode and decode: Difference between revisions

m
Line 781:
=={{header|Lingo}}==
Since UTF-8 is Lingo's native string encoding, and UTF-8 strings can be read into byteArrays (and v.v.), such UTF-8 encoding and decoding is built-in.<br />
<br />
Relevant Lingo functions are:<br />
- charToNum(string): converts single-character string to unicode code point (int)<br />
- numToChar(int): converts unicode code point (int) to single-character string<br />
- byteArray(string): creates byte array of UTF-8 bytes for string<br />
- byteArray.toHexString(start, length): returns hex string representation of byte array (e.g. for printing)
<lang Lingo>chars = ["A", "ö", "Ж", "€", "𝄞"]
put "Character Unicode (int) UTF-8 (hex) Decoded"
Anonymous user