SingleByteCodec
in package
implements
Codec
Read onlyYes
FinalYes
Code pages whose bytes 0x00–0x7F are ASCII and 0x80–0xFF come from a table.
Table of Contents
Interfaces
- Codec
- Converts between one character encoding and UTF-8.
Methods
- __construct() : mixed
- decode() : string|null
- Decodes to UTF-8, or returns null when the bytes are not valid in this encoding.
- decodeLossy() : string
- Decodes to UTF-8, replacing every invalid or undefined sequence with U+FFFD.
- encode() : string
Methods
__construct()
public
__construct(string $name, array<int, string> $table) : mixed
Parameters
- $name : string
- $table : array<int, string>
-
byte (0x80–0xFF) → UTF-8; missing bytes are undefined
decode()
Decodes to UTF-8, or returns null when the bytes are not valid in this encoding.
public
decode(string $bytes) : string|null
Parameters
- $bytes : string
Return values
string|nulldecodeLossy()
Decodes to UTF-8, replacing every invalid or undefined sequence with U+FFFD.
public
decodeLossy(string $bytes) : string
Parameters
- $bytes : string
Return values
stringencode()
public
encode(string $utf8) : string
Parameters
- $utf8 : string