phpday 2027 - Call for Papers

The UConverter class

(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)

Introduction

Class synopsis

class UConverter {
/* Constants */
public const int REASON_UNASSIGNED;
public const int REASON_ILLEGAL;
public const int REASON_IRREGULAR;
public const int REASON_RESET;
public const int REASON_CLOSE;
public const int REASON_CLONE;
public const int SBCS;
public const int DBCS;
public const int MBCS;
public const int LATIN_1;
public const int UTF8;
public const int UTF16_BigEndian;
public const int UTF16_LittleEndian;
public const int UTF32_BigEndian;
public const int UTF32_LittleEndian;
public const int EBCDIC_STATEFUL;
public const int ISO_2022;
public const int LMBCS_1;
public const int LMBCS_2;
public const int LMBCS_3;
public const int LMBCS_4;
public const int LMBCS_5;
public const int LMBCS_6;
public const int LMBCS_8;
public const int LMBCS_11;
public const int LMBCS_16;
public const int LMBCS_17;
public const int LMBCS_18;
public const int LMBCS_19;
public const int LMBCS_LAST;
public const int HZ;
public const int SCSU;
public const int ISCII;
public const int US_ASCII;
public const int UTF7;
public const int BOCU1;
public const int UTF16;
public const int UTF32;
public const int CESU8;
public const int IMAP_MAILBOX;
/* Methods */
public function __construct(?string $destination_encoding = null, ?string $source_encoding = null)
public function convert(string $str, bool $reverse = false): string|false
public function fromUCallback(
    int $reason,
    array $source,
    int $codePoint,
    int &$error
): string|int|array|null
public static function getAliases(string $name): array|false|null
public static function getAvailable(): array
public function getDestinationType(): int|false|null
public function getErrorCode(): int
public function getErrorMessage(): ?string
public function getSourceEncoding(): string|false|null
public function getSourceType(): int|false|null
public static function getStandards(): ?array
public function getSubstChars(): string|false|null
public static function reasonText(int $reason): string
public function setDestinationEncoding(string $encoding): bool
public function setSourceEncoding(string $encoding): bool
public function setSubstChars(string $chars): bool
public function toUCallback(
    int $reason,
    string $source,
    string $codeUnits,
    int &$error
): string|int|array|null
public static function transcode(
    string $str,
    string $toEncoding,
    string $fromEncoding,
    ?array $options = null
): string|false
}

Changelog

Version Description
8.4.0 The class constants are now typed.

Table of Contents

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top