C++ Builder 参考手册 ➙ System::Sysutils ➙ LCIDToCodePage
地区标识 LCID 转为 ANSI 编码的代码页
头文件:#include <System.SysUtils.hpp>
命名空间:System::Sysutils
函数原型:
int __fastcall LCIDToCodePage(const unsigned ALCID);
参数:
- ALCID:地区标识,LCID (Locale Identifier, Locale ID);
返回值:
- ANSI 编码的代码页,CodePage
- 0:如果函数执行失败 (不支持的代码页) 函数返回 0
- 如果需要知道某个国家或地区的语言的 ANSI 编码的代码页,可以通过这个函数获取;
- ANSI 编码使用代码页 (CodePage) 表示不同的 ANSI 编码,代码页不同会引起乱码,
不同国家的 ANSI 代码页可能相同,同一个国家的不同地区 ANSI 代码页可能不同,
例如中国大陆代码页为 936,新加坡中文代码页也是 936,而中国港澳台代码页为 950; - 通过获取操作系统支持的语言 (例如函数 Languages) 得到的是地区标识,即 LocaleID (请参考函数 Languages 的例子);
- 通过 API 函数 MAKELANGID 通过国家和语言得到的是 LocaleID,例如 MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED) 得到的是简体中文的 LocaleID,即 0x0804,与函数 Languages 得到的值是相同的;
- 全局变量 System::Sysutils::SysLocale 保存的是系统默认的地区标识 (Locale ID);
- UNICODE 编码与代码页无关,因为代码页表示的是 ANSI 编码,而 UNICODE 是世界所有的语言统一编码;
- 现在编程需要使用 UNICODE 编码,除非特殊需要,一般不需要处理 ANSI 编码。
相关:
- System::Sysutils::TEncoding::CodePage
- System::Sysutils::TEncoding
- System::Sysutils::SysLocale
- System::Sysutils::TSysLocale
- System::Sysutils::Languages
- System::Sysutils::TLanguages
- System::Sysutils::FormatSettings
- System::Sysutils::TFormatSettings
- System::Sysutils::GetFormatSettings
- System::Sysutils::GetDefaultFallbackLanguages
- System::Sysutils::SetDefaultFallbackLanguages
- System::Sysutils::PreferredUILanguages
- System::Sysutils::PreferredUILanguageList
- System::Sysutils::LocaleFileExists
- System::Sysutils::GetLocaleFile
- System::Sysutils::LocaleDirectoryExists
- System::Sysutils::GetLocaleDirectory
- System::Sysutils::ResStringCleanupCache
- System::Sysutils::LoadStr
- System::Sysutils::FmtLoadStr
- System::Sysutils
- C++ Builder 本地化 (多语言) 功能
C++ Builder 参考手册 ➙ System::Sysutils ➙ LCIDToCodePage