Windows系统对中文生僻字支持问题的解决办法

Windows系统对中文生僻字支持问题的解决办法

1.Windows API对GB18030-2000 的支持下列 Windows API 提供对GB18030-2000 的支持。

  IsValidCodePage(), GetCPInfo(), MultiByteToWideChar() and WideCharToMultiByte().
具体说明如下:
1) IsValidCodePage(54936) returns TRUE.
2) GetCPInfo(54936, lpCPInfo) returns TRUE.
3) MultiByteToWideChar(54936, 0, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar) 完成GB18030-2000 字符串 lpMultiByteStr 到 Unicode 字符串 lpWideCharStr  的转换。
4) WideCharToMultiByte(54936, 0, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar) 完成Unicode 字符串 lpWideCharStr 到 GB18030-2000 字符串 lpMultiByteStr  的转换。

2. GB18030 函数库
  微软4字节字符集编码支持包 (MS4BSP- Microsoft 4-byte Character Set Encoding Support Package) 提供了六个函数,这六个函数支持多字节编码(多达4字节)的字符串。 这些API 是从Windows 95/98/Me 提供的WCHAR (Unicode) 函数集中精选出来的。函数名与相应的ANSI 和WCHAR(Unicode) 函数完全相同,只是后缀的’A’ 或’W’被’L’替代。这些函数的参数与相应的’A’版本函数的参数接口完全相同。该支持包可使基于936代码页的应用程序向GB18030 或其他4字节编码的转换更加快捷。
  MS4BSP 在Windows XP 平台的实现是作为一个简单的动态连接库 – ms4bsp.dll。 每一函数都通过调用MultiByteToWideChar() 函数将任何多字节字符串输入参数转换为UTF-16编码格式,然后调用相应的 ‘W’ 版本的函数,返回该函数的输出参数。该动态连接库假设当前系统中存在相关的字体,输入法(IME) 和注册表的设置信息。
该函数集中的缺省4字节字符编码为54936 (GB18030-2000). 将来版本的MS4BL 可能支持其他4字节编码。

 

接口清单:

BOOL ExtTextOutL(
 HDC hdc, // handle to DC
 int X, // x-coordinate of reference point
 int Y, // y-coordinate of reference point
 UINT fuOptions, // text-output options
 CONST RECT* lprc, // optional dimensions
 LPCSTR lpString, // string
 UINT cbCount, // number of characters in string
 CONST INT* lpDx // array of spacing values
);
BOOL GetTextExtentExPointL(
 HDC hdc, // handle to DC
 LPCSTR lpszStr, // character string
 int cchString, // number of characters
 int nMaxExtent, // maximum width of formatted string
 LPINT lpnFit, // maximum number of characters
 LPINT alpDx, // array of partial string widths
 LPSIZE lpSize // string dimensions
);
BOOL GetTextExtentPoint32L(
 HDC hdc, // handle to DC
 LPCSTR lpString, // text string
 int cbString, // characters in string
 LPSIZE lpSize // string size
);
Int MessageBoxL(
 HWND hWnd, // handle to owner window
 LPCSTR lpText, // text in message box
 LPCSTR lpCaption, // message box title
 UINT uType // message box style
);
Int MessageBoxExL(
 HWND hWnd, // handle to owner window
 LPCSTR lpText, // text in message box
 LPCSTR lpCaption, // message box title
 UINT uType, // message box style
 WORD wLanguageId // language identifier
);
BOOL TextOutL(
 HDC hdc, // handle to DC
 int nXStart, // x-coordinate of starting position
 int nYStart, // y-coordinate of starting position
 LPCSTR lpString, // character string
 int cbString // number of characters
);


 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值