Function codepage::to_encoding

source ·
pub fn to_encoding(code_page: u16) -> Option<&'static Encoding>
Expand description

Maps a Windows code page identifier to an encoding_rs Encoding (or None if there is no appropriate mapping).

In some cases, multiple code page identifiers maps to a single Encoding. For example, 28591 for ISO-8859-1 maps to the windows-1252 encoding, since the two are unified in the Web Platform. The EUC family of CJK encodings has multiple code page identifiers. For example, EUC-KR has 949, 20949 and 51949. (At present, x-mac-korean, 10003, maps to None, though.)

Code page identifiers whose corresponding labels would map to the replacement encoding also map to the replacement encoding here.