pub fn encoding_from_windows_code_page(cp: usize) -> Option<EncodingRef> {
    match cp {
        65001 => Some(all::UTF_8 as EncodingRef),
        866 => Some(all::IBM866 as EncodingRef),
        28591 => Some(all::ISO_8859_1 as EncodingRef),
        28592 => Some(all::ISO_8859_2 as EncodingRef),
        28593 => Some(all::ISO_8859_3 as EncodingRef),
        28594 => Some(all::ISO_8859_4 as EncodingRef),
        28595 => Some(all::ISO_8859_5 as EncodingRef),
        28596 => Some(all::ISO_8859_6 as EncodingRef),
        28597 => Some(all::ISO_8859_7 as EncodingRef),
        28598 => Some(all::ISO_8859_8 as EncodingRef),
        38598 => Some(all::whatwg::ISO_8859_8_I as EncodingRef),
        28603 => Some(all::ISO_8859_13 as EncodingRef),
        28605 => Some(all::ISO_8859_15 as EncodingRef),
        20866 => Some(all::KOI8_R as EncodingRef),
        21866 => Some(all::KOI8_U as EncodingRef),
        10000 => Some(all::MAC_ROMAN as EncodingRef),
        874 => Some(all::WINDOWS_874 as EncodingRef),
        1250 => Some(all::WINDOWS_1250 as EncodingRef),
        1251 => Some(all::WINDOWS_1251 as EncodingRef),
        1252 => Some(all::WINDOWS_1252 as EncodingRef),
        1253 => Some(all::WINDOWS_1253 as EncodingRef),
        1254 => Some(all::WINDOWS_1254 as EncodingRef),
        1255 => Some(all::WINDOWS_1255 as EncodingRef),
        1256 => Some(all::WINDOWS_1256 as EncodingRef),
        1257 => Some(all::WINDOWS_1257 as EncodingRef),
        1258 => Some(all::WINDOWS_1258 as EncodingRef),
        1259 => Some(all::MAC_CYRILLIC as EncodingRef),
        936 | 54936 => Some(all::GB18030 as EncodingRef), // XXX technically wrong
        52936 => Some(all::HZ as EncodingRef),
        950 => Some(all::BIG5_2003 as EncodingRef),
        20932 => Some(all::EUC_JP as EncodingRef),
        50220 => Some(all::ISO_2022_JP as EncodingRef),
        932 => Some(all::WINDOWS_31J as EncodingRef),
        949 => Some(all::WINDOWS_949 as EncodingRef),
        1201 => Some(all::UTF_16BE as EncodingRef),
        1200 => Some(all::UTF_16LE as EncodingRef),
        _ => None
    }
}
/// Returns an encoding from Windows code page number.
/// http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx
/// Sometimes it can return a *superset* of the requested encoding, e.g. for several CJK encodings.
Returns an encoding from Windows code page number.
Returns an encoding from Windows code page number .
pub fn encoding_from_windows_code_page(cp: usize) -> Option<EncodingRef> {
    match cp {
        65001 => Some(all::UTF_8 as EncodingRef),
        866 => Some(all::IBM866 as EncodingRef),
        28591 => Some(all::ISO_8859_1 as EncodingRef),
        28592 => Some(all::ISO_8859_2 as EncodingRef),
        28593 => Some(all::ISO_8859_3 as EncodingRef),
        28594 => Some(all::ISO_8859_4 as EncodingRef),
        28595 => Some(all::ISO_8859_5 as EncodingRef),
        28596 => Some(all::ISO_8859_6 as EncodingRef),
        28597 => Some(all::ISO_8859_7 as EncodingRef),
        28598 => Some(all::ISO_8859_8 as EncodingRef),
        38598 => Some(all::whatwg::ISO_8859_8_I as EncodingRef),
        28603 => Some(all::ISO_8859_13 as EncodingRef),
        28605 => Some(all::ISO_8859_15 as EncodingRef),
        20866 => Some(all::KOI8_R as EncodingRef),
        21866 => Some(all::KOI8_U as EncodingRef),
        10000 => Some(all::MAC_ROMAN as EncodingRef),
        874 => Some(all::WINDOWS_874 as EncodingRef),
        1250 => Some(all::WINDOWS_1250 as EncodingRef),
        1251 => Some(all::WINDOWS_1251 as EncodingRef),
        1252 => Some(all::WINDOWS_1252 as EncodingRef),
        1253 => Some(all::WINDOWS_1253 as EncodingRef),
        1254 => Some(all::WINDOWS_1254 as EncodingRef),
        1255 => Some(all::WINDOWS_1255 as EncodingRef),
        1256 => Some(all::WINDOWS_1256 as EncodingRef),
        1257 => Some(all::WINDOWS_1257 as EncodingRef),
        1258 => Some(all::WINDOWS_1258 as EncodingRef),
        1259 => Some(all::MAC_CYRILLIC as EncodingRef),
        936 | 54936 => Some(all::GB18030 as EncodingRef), // XXX technically wrong
        52936 => Some(all::HZ as EncodingRef),
        950 => Some(all::BIG5_2003 as EncodingRef),
        20932 => Some(all::EUC_JP as EncodingRef),
        50220 => Some(all::ISO_2022_JP as EncodingRef),
        932 => Some(all::WINDOWS_31J as EncodingRef),
        949 => Some(all::WINDOWS_949 as EncodingRef),
        1201 => Some(all::UTF_16BE as EncodingRef),
        1200 => Some(all::UTF_16LE as EncodingRef),
        _ => None
    }
}
pub fn encoding_from_windows_code_page ( cp : usize ) -> Option < EncodingRef > { match cp { 65001 => Some ( all :: UTF_8 as EncodingRef ) , 866 => Some ( all :: IBM866 as EncodingRef ) , 28591 => Some ( all :: ISO_8859_1 as EncodingRef ) , 28592 => Some ( all :: ISO_8859_2 as EncodingRef ) , 28593 => Some ( all :: ISO_8859_3 as EncodingRef ) , 28594 => Some ( all :: ISO_8859_4 as EncodingRef ) , 28595 => Some ( all :: ISO_8859_5 as EncodingRef ) , 28596 => Some ( all :: ISO_8859_6 as EncodingRef ) , 28597 => Some ( all :: ISO_8859_7 as EncodingRef ) , 28598 => Some ( all :: ISO_8859_8 as EncodingRef ) , 38598 => Some ( all :: whatwg :: ISO_8859_8_I as EncodingRef ) , 28603 => Some ( all :: ISO_8859_13 as EncodingRef ) , 28605 => Some ( all :: ISO_8859_15 as EncodingRef ) , 20866 => Some ( all :: KOI8_R as EncodingRef ) , 21866 => Some ( all :: KOI8_U as EncodingRef ) , 10000 => Some ( all :: MAC_ROMAN as EncodingRef ) , 874 => Some ( all :: WINDOWS_874 as EncodingRef ) , 1250 => Some ( all :: WINDOWS_1250 as EncodingRef ) , 1251 => Some ( all :: WINDOWS_1251 as EncodingRef ) , 1252 => Some ( all :: WINDOWS_1252 as EncodingRef ) , 1253 => Some ( all :: WINDOWS_1253 as EncodingRef ) , 1254 => Some ( all :: WINDOWS_1254 as EncodingRef ) , 1255 => Some ( all :: WINDOWS_1255 as EncodingRef ) , 1256 => Some ( all :: WINDOWS_1256 as EncodingRef ) , 1257 => Some ( all :: WINDOWS_1257 as EncodingRef ) , 1258 => Some ( all :: WINDOWS_1258 as EncodingRef ) , 1259 => Some ( all :: MAC_CYRILLIC as EncodingRef ) , 936 | 54936 => Some ( all :: GB18030 as EncodingRef ) , // XXX technically wrong 52936 => Some ( all :: HZ as EncodingRef ) , 950 => Some ( all :: BIG5_2003 as EncodingRef ) , 20932 => Some ( all :: EUC_JP as EncodingRef ) , 50220 => Some ( all :: ISO_2022_JP as EncodingRef ) , 932 => Some ( all :: WINDOWS_31J as EncodingRef ) , 949 => Some ( all :: WINDOWS_949 as EncodingRef ) , 1201 => Some ( all :: UTF_16BE as EncodingRef ) , 1200 => Some ( all :: UTF_16LE as EncodingRef ) , _ => None } }
Returns an encoding from Windows code page number.
Returns an encoding from Windows code page number .
cp
usize
cp
usize