UTF8

Summary

Provides UTF-8 encoding and decoding.

Description

This class provides UTF-8 encoding and decoding methods.

UTF-8 is a variable-width character encoding defined by the Unicode Standard. Each character is represented using one to four 8-bit bytes.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
import System;
import System.Encoding;
  
byte[] encoded = UTF8.encode("�");
  
string toHex = "";
foreach(byte b in encoded) {
    toHex += "\\x" + b.toHex().toUpperCase();
}
  
Console.log(toHex); // "\xE2\x82\xAC"

Methods

  • decode

    Decodes UTF-8 encoded text.

  • encode

    Encodes a string of text using UTF-8 encoding.

Share

HTML | BBCode | Direct Link