Charset uses ConstantsTrait
Enumeration of character set (charset) names.
These are the IANA / WHATWG charset labels carried by the charset
parameter of a Content-Type header (text/html; charset=utf-8). The same
labels are commonly accepted by PHP's mb_* / iconv functions, which are
case-insensitive and recognise many aliases. Charset tokens are
case-insensitive on the wire (RFC 9110 §8.3.2); the lowercase WHATWG form is
kept here.
This is the string-name counterpart of CharacterSet,
which holds the numeric IANA MIBenum codes (e.g. 106 for UTF-8) used by
some database drivers. Use this class wherever a charset name is needed.
Example:
$type = MediaType::withCharset( MediaType::HTML , Charset::UTF_8 ) ;
// 'text/html; charset=utf-8'
Tags
Table of Contents
Constants
- BIG5 : string = 'big5'
- `big5` — Traditional Chinese.
- EUC_JP : string = 'euc-jp'
- `euc-jp` — Japanese (Extended Unix Code).
- EUC_KR : string = 'euc-kr'
- `euc-kr` — Korean (Extended Unix Code).
- GB18030 : string = 'gb18030'
- `gb18030` — Chinese, full Unicode coverage.
- GB2312 : string = 'gb2312'
- `gb2312` — Simplified Chinese.
- GBK : string = 'gbk'
- `gbk` — Simplified Chinese (extends GB2312).
- ISO_2022_JP : string = 'iso-2022-jp'
- `iso-2022-jp` — Japanese (JIS).
- ISO_8859_1 : string = 'iso-8859-1'
- `iso-8859-1` — Latin-1, Western European.
- ISO_8859_15 : string = 'iso-8859-15'
- `iso-8859-15` — Latin-9, Western European with the euro sign.
- ISO_8859_2 : string = 'iso-8859-2'
- `iso-8859-2` — Latin-2, Central European.
- ISO_8859_5 : string = 'iso-8859-5'
- `iso-8859-5` — Latin/Cyrillic.
- KOI8_R : string = 'koi8-r'
- `koi8-r` — Russian Cyrillic.
- SHIFT_JIS : string = 'shift_jis'
- `shift_jis` — Japanese.
- US_ASCII : string = 'us-ascii'
- `us-ascii` — 7-bit ASCII.
- UTF_16 : string = 'utf-16'
- `utf-16` — Unicode, 16-bit, byte order detected from a BOM.
- UTF_16BE : string = 'utf-16be'
- `utf-16be` — Unicode, 16-bit, big-endian.
- UTF_16LE : string = 'utf-16le'
- `utf-16le` — Unicode, 16-bit, little-endian.
- UTF_32 : string = 'utf-32'
- `utf-32` — Unicode, 32-bit.
- UTF_8 : string = 'utf-8'
- `utf-8` — Unicode, variable-width. The recommended default for the web.
- WINDOWS_1250 : string = 'windows-1250'
- `windows-1250` — Central European.
- WINDOWS_1251 : string = 'windows-1251'
- `windows-1251` — Cyrillic.
- WINDOWS_1252 : string = 'windows-1252'
- `windows-1252` — Western European (superset of ISO-8859-1).
Constants
BIG5
`big5` — Traditional Chinese.
public
string
BIG5
= 'big5'
EUC_JP
`euc-jp` — Japanese (Extended Unix Code).
public
string
EUC_JP
= 'euc-jp'
EUC_KR
`euc-kr` — Korean (Extended Unix Code).
public
string
EUC_KR
= 'euc-kr'
GB18030
`gb18030` — Chinese, full Unicode coverage.
public
string
GB18030
= 'gb18030'
GB2312
`gb2312` — Simplified Chinese.
public
string
GB2312
= 'gb2312'
GBK
`gbk` — Simplified Chinese (extends GB2312).
public
string
GBK
= 'gbk'
ISO_2022_JP
`iso-2022-jp` — Japanese (JIS).
public
string
ISO_2022_JP
= 'iso-2022-jp'
ISO_8859_1
`iso-8859-1` — Latin-1, Western European.
public
string
ISO_8859_1
= 'iso-8859-1'
ISO_8859_15
`iso-8859-15` — Latin-9, Western European with the euro sign.
public
string
ISO_8859_15
= 'iso-8859-15'
ISO_8859_2
`iso-8859-2` — Latin-2, Central European.
public
string
ISO_8859_2
= 'iso-8859-2'
ISO_8859_5
`iso-8859-5` — Latin/Cyrillic.
public
string
ISO_8859_5
= 'iso-8859-5'
KOI8_R
`koi8-r` — Russian Cyrillic.
public
string
KOI8_R
= 'koi8-r'
SHIFT_JIS
`shift_jis` — Japanese.
public
string
SHIFT_JIS
= 'shift_jis'
US_ASCII
`us-ascii` — 7-bit ASCII.
public
string
US_ASCII
= 'us-ascii'
UTF_16
`utf-16` — Unicode, 16-bit, byte order detected from a BOM.
public
string
UTF_16
= 'utf-16'
UTF_16BE
`utf-16be` — Unicode, 16-bit, big-endian.
public
string
UTF_16BE
= 'utf-16be'
UTF_16LE
`utf-16le` — Unicode, 16-bit, little-endian.
public
string
UTF_16LE
= 'utf-16le'
UTF_32
`utf-32` — Unicode, 32-bit.
public
string
UTF_32
= 'utf-32'
UTF_8
`utf-8` — Unicode, variable-width. The recommended default for the web.
public
string
UTF_8
= 'utf-8'
WINDOWS_1250
`windows-1250` — Central European.
public
string
WINDOWS_1250
= 'windows-1250'
WINDOWS_1251
`windows-1251` — Cyrillic.
public
string
WINDOWS_1251
= 'windows-1251'
WINDOWS_1252
`windows-1252` — Western European (superset of ISO-8859-1).
public
string
WINDOWS_1252
= 'windows-1252'