- // FIXME: this information should be transferred to lib/encodings
- // UTF8 uses at most 4 bytes to represent one UCS4 code point
- // (see RFC 3629). RFC 2279 specifies 6 bytes, but that
- // information is outdated, and RFC 2279 has been superseded by
- // RFC 3629.
- // The CJK encodings use (different) multibyte representation as well.
- // All other encodings encode one UCS4 code point in one byte
- // (and can therefore only encode a subset of UCS4)
- // Note that BIG5 and SJIS do not work with LaTeX (see lib/encodings).
- // Furthermore, all encodings that use shifting (like SJIS) do not work with
- // iconv_codecvt_facet.
- if (encoding_ == "UTF-8" ||
- encoding_ == "GB" ||
- encoding_ == "EUC-TW")
- return 4;
- else if (encoding_ == "EUC-JP" ||
- encoding_ == "ISO-2022-JP")
- return 3;
- else if (encoding_ == "BIG5" ||
- encoding_ == "EUC-KR" ||
- encoding_ == "EUC-CN" ||
- encoding_ == "SJIS" ||
- encoding_ == "GBK")
- return 2;
- else
- return 1;