MultiByteToWideChar() Codepages CP_ACP/CP_OEMCP
来源:互联网 发布:你呀上瘾了网络剧 编辑:程序博客网 时间:2024/05/03 07:48
source:http://support.microsoft.com/?scid=kb%3Ben-us%3B108450&x=11&y=12
MultiByteToWideChar() Codepages CP_ACP/CP_OEMCP
View products that this article applies to.
This article was previously published under Q108450
SUMMARYMultiByteToWideChar() maps a character string to a wide-character string. The d...
MultiByteToWideChar() maps a character string to a wide-character string.The declaration of this application programming interface (API) is asfollows:The first parameter, uCodePage, specifies the codepage to be used whenperforming the conversion. This discussion applies to the first parameterof WideCharToMultiByte() as well. The codepage can be any valid codepagenumber. It is a good idea to check this number with IsValidCodepage(), eventhough MultiByteToWideChar() returns an error if an invalid codepage isused. The codepage may also be one of the following values:CP_ACP instructs the API to use the currently set default Windows ANSIcodepage. CP_OEMCP instructs the API to use the currently set default OEMcodepage.
If Win32 ANSI APIs are used to get filenames from a Windows NT system, useCP_ACP when converting the string. Windows NT retrieves the name from thephysical device and translates the OEM name into Unicode. The Unicode nameis translated into ANSI if an ANSI API is called, then it can be translatedback into Unicode with MultiByteToWideChar().
If filenames are being retrieved from a file that is OEM encoded, useCP_OEMCP instead.
int MultiByteToWideChar(uCodePage, dwFlags, lpMultiByteStr,
cchMultiByte, lpWideCharStr, cchWideChar)
UINT uCodePage; /* codepage */
DWORD dwFlags; /* character-type options */
LPCSTR lpMultiByteStr; /* address of string to map */
int cchMultiByte; /* number of characters in string */
LPWSTR lpWideCharStr; /* address of wide-character buffer */
int cchWideChar; /* size of wide-character buffer */
CP_ACP ANSI codepage
CP_OEMCP OEM (original equipment manufacturer) codepage
If Win32 ANSI APIs are used to get filenames from a Windows NT system, useCP_ACP when converting the string. Windows NT retrieves the name from thephysical device and translates the OEM name into Unicode. The Unicode nameis translated into ANSI if an ANSI API is called, then it can be translatedback into Unicode with MultiByteToWideChar().
If filenames are being retrieved from a file that is OEM encoded, useCP_OEMCP instead.
MORE INFORMATIONWhen an application calls an ANSI function, the FAT/HPFS file systems will call...
When an application calls an ANSI function, the FAT/HPFS file systems willcall AnsiToOem(); however, if an ANSI character does not exist in an OEMcodepage, the filename will not be representable. In these cases,SetFileApisToOEM() should be called to prevent this problem by setting agroup of the Win32 APIs to use the OEM codepage instead of the ANSIcodepage.
APPLIES TO
- Microsoft Platform Software Development Kit-January 2000 Edition
- Microsoft Win32 Software Development Kit (SDK) for Windows NT 3.5
- MultiByteToWideChar() Codepages CP_ACP/CP_OEMCP
- windows的CP_ACP代码页与CP_OEMCP代码页区别
- Windows上的字符转换之CP_ACP和CP_OEMCP
- Windows上的字符转换之CP_ACP和CP_OEMCP
- Windows上的字符转换之CP_ACP和CP_OEMCP
- MultiByteToWideChar()
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- MultiByteToWideChar
- Character sets and codepages
- 字符集、codepages、setlocal
- CP_THREAD_ACP与CP_ACP区别
- 关于mysql、数字类型之间转换的问题
- vim 全局批量替换
- jasper 生成 PDF 代码
- arm的存储管理单元MMU [转]
- "愚乐",我的漫谈!
- MultiByteToWideChar() Codepages CP_ACP/CP_OEMCP
- Java获取IP并存储数据库
- VMware中运行图形Linux的设置技巧
- SVN的安装和配置
- SQL Server 索引维护
- 类加载器体系
- 给IReport添加字段的简便方法
- 关于Windows内核对象
- 1.Java Web 部署描述符web.xml