如何判断一个codec是否有const ratio 'byte number per character'?

How to determine whether a codec has a const ratio 'byte number per character'?

给定一个 IANA 编解码器名称(或 iconv/ICU 中使用的名称之一),确定编解码器是否具有固定宽度的字符表示的最简单方法是什么?

使用ucnv_isFixedWidth():

UErrorCode status;
UConverter* converter = ucnv_open("koi8-r", &status);
if (U_SUCCESS(status)) {
  UBool is_fixed = ucnv_isFixedWidth(converter, &status);
}