use crate::Encoding;
use crate::encodings as e;
pub(crate) struct CodePage {
pub(crate) number: u32,
pub(crate) encoding: &'static Encoding,
pub(crate) canonical: bool,
}
const fn cp(number: u32, encoding: &'static Encoding) -> CodePage {
CodePage {
number,
encoding,
canonical: true,
}
}
#[allow(dead_code)]
const fn alias(number: u32, encoding: &'static Encoding) -> CodePage {
CodePage {
number,
encoding,
canonical: false,
}
}
pub(crate) static CODE_PAGES: &[CodePage] = &[
#[cfg(feature = "single-byte")]
alias(708, &e::ISO_8859_6_INIT), #[cfg(feature = "single-byte")]
cp(866, &e::IBM866_INIT),
#[cfg(feature = "single-byte")]
cp(874, &e::WINDOWS_874_INIT),
#[cfg(feature = "shift-jis")]
cp(932, &e::WINDOWS_31J_INIT),
#[cfg(feature = "gb18030")]
cp(936, &e::GBK_INIT), #[cfg(feature = "euc-kr")]
cp(949, &e::EUC_KR_INIT), cp(1200, &e::UTF_16LE_INIT),
cp(1201, &e::UTF_16BE_INIT),
#[cfg(feature = "single-byte")]
cp(1250, &e::WINDOWS_1250_INIT),
#[cfg(feature = "single-byte")]
cp(1251, &e::WINDOWS_1251_INIT),
#[cfg(feature = "single-byte")]
cp(1252, &e::WINDOWS_1252_INIT),
#[cfg(feature = "single-byte")]
cp(1253, &e::WINDOWS_1253_INIT),
#[cfg(feature = "single-byte")]
cp(1254, &e::WINDOWS_1254_INIT),
#[cfg(feature = "single-byte")]
cp(1255, &e::WINDOWS_1255_INIT),
#[cfg(feature = "single-byte")]
cp(1256, &e::WINDOWS_1256_INIT),
#[cfg(feature = "single-byte")]
cp(1257, &e::WINDOWS_1257_INIT),
#[cfg(feature = "single-byte")]
cp(1258, &e::WINDOWS_1258_INIT),
#[cfg(feature = "single-byte")]
cp(10000, &e::MACINTOSH_INIT),
#[cfg(feature = "single-byte")]
cp(10007, &e::X_MAC_CYRILLIC_INIT),
#[cfg(feature = "single-byte")]
alias(10017, &e::X_MAC_CYRILLIC_INIT), #[cfg(feature = "single-byte")]
#[cfg(feature = "single-byte")]
cp(20866, &e::KOI8_R_INIT),
#[cfg(feature = "gb18030")]
alias(20936, &e::GBK_INIT), #[cfg(feature = "euc-kr")]
alias(20949, &e::EUC_KR_INIT), #[cfg(feature = "single-byte")]
cp(21866, &e::KOI8_U_INIT),
#[cfg(feature = "single-byte")]
#[cfg(feature = "single-byte")]
cp(28592, &e::ISO_8859_2_INIT),
#[cfg(feature = "single-byte")]
cp(28593, &e::ISO_8859_3_INIT),
#[cfg(feature = "single-byte")]
cp(28594, &e::ISO_8859_4_INIT),
#[cfg(feature = "single-byte")]
cp(28595, &e::ISO_8859_5_INIT),
#[cfg(feature = "single-byte")]
cp(28596, &e::ISO_8859_6_INIT),
#[cfg(feature = "single-byte")]
cp(28597, &e::ISO_8859_7_INIT),
#[cfg(feature = "single-byte")]
cp(28598, &e::ISO_8859_8_INIT),
#[cfg(feature = "single-byte")]
#[cfg(feature = "single-byte")]
cp(28603, &e::ISO_8859_13_INIT),
#[cfg(feature = "single-byte")]
cp(28605, &e::ISO_8859_15_INIT),
#[cfg(feature = "single-byte")]
cp(38598, &e::ISO_8859_8_I_INIT),
#[cfg(feature = "iso-2022-jp")]
alias(50221, &e::X_WHATWG_ISO_2022_JP_INIT), #[cfg(feature = "iso-2022-jp")]
alias(50222, &e::X_WHATWG_ISO_2022_JP_INIT), #[cfg(feature = "euc-jp")]
cp(51932, &e::X_WHATWG_EUC_JP_INIT),
#[cfg(feature = "gb18030")]
alias(51936, &e::GBK_INIT), #[cfg(feature = "euc-kr")]
alias(51949, &e::EUC_KR_INIT),
#[cfg(feature = "gb18030")]
cp(54936, &e::GB18030_INIT),
cp(65001, &e::UTF_8_INIT),
];