多字节字符序列的解释Interpretation of multibyte-character sequences

Microsoft 运行库中的大多数多字节字符例程可识别与多字节代码页相关的多字节字符序列。Most multibyte-character routines in the Microsoft run-time library recognize multibyte-character sequences relating to a multibyte code page. 输出值受区域设置的LC_CTYPE类别设置的设置影响。The output value is affected by the setting of the LC_CTYPE category setting of the locale. 有关详细信息,请参阅 setlocaleFor more information, see setlocale. 这些不带 _l后缀的函数的版本对与区域设置相关的行为使用当前区域设置。The versions of these functions without the _l suffix use the current locale for this locale-dependent behavior. 带有 _l后缀的版本是相同的,只不过它们使用区域设置参数而不是当前区域设置。The versions with the _l suffix are identical, except they use the locale parameter instead of the current locale.

与区域设置相关的多字节例程Locale-dependent multibyte routines

例程所返回的值Routine 使用“管理”工作区中的“连接的管理组”Use
_mbclen、mblen、_mblen_l_mbclen, mblen, _mblen_l 验证并返回多字节字符中的字节数Validate and return number of bytes in multibyte character
strlen、wcslen、_mbslen、_mbslen_l、_mbstrlen、_mbstrlen_lstrlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l 对于多字节字符串:验证字符串中的每个字符;返回字符串的长度。For multibyte character strings: validate each character in string; return string length. 对于宽字符字符串:返回字符串长度。For wide character strings: return string length.
mbstowcs、_mbstowcs_lmbstowcs_s、_mbstowcs_s_lmbstowcs, _mbstowcs_l, mbstowcs_s, _mbstowcs_s_l 将多字节字符序列转换为对应的宽字符序列Convert sequence of multibyte characters to corresponding sequence of wide characters
mbtowc、_mbtowc_lmbtowc, _mbtowc_l 将多字节字符转换为对应的宽字符Convert multibyte character to corresponding wide character
wcstombs、_wcstombs_lwcstombs_s、_wcstombs_s_lwcstombs, _wcstombs_l, wcstombs_s, _wcstombs_s_l 将宽字符序列转换为相应的多字节字符序列Convert sequence of wide characters to corresponding sequence of multibyte characters
wctomb、_wctomb_lwctomb_s、_wctomb_s_lwctomb, _wctomb_l, wctomb_s, _wctomb_s_l 将宽字符转换为相应的多字节字符Convert wide character to corresponding multibyte character

独立于区域设置的多字节例程Locale-independent multibyte routines

例程所返回的值Routine 使用“管理”工作区中的“连接的管理组”Use
mbrtoc16、mbrtoc32mbrtoc16, mbrtoc32 将多字节 UTF-8 字符转换为等效的 UTF-16 或 UTF-32 字符Convert multibyte UTF-8 character to equivalent UTF-16 or UTF-32 character
c16rtomb、c32rtombc16rtomb, c32rtomb 将 UTF-16 或 UTF-32 字符转换为等效的 UTF-8 多字节字符Convert UTF-16 or UTF-32 character to equivalent UTF-8 multibyte character

请参阅See also

国际化Internationalization
按类别分的通用 C 运行时例程Universal C runtime routines by category