Summary

When converting the full-width Unicode numbers (U+FF10-U+FF19) to standard half-width numbers (U+0030-U+0039)while using WideCharToMultiByte, it fails to do the conversion on Windows 95 and 98. One should use the API LCMapString with flag LCMAP_HALFWIDTH to convert the full-width characters to half-width characters.

More Information

Since the W version of this API does not work on Windows 95 and Windows 98 one needs to convert the full-width characters from Unicode to proper DBCS strings, and then call LCMapString to do the conversion. Here is a sample working with full-width Unicode numbers in traditional Chinese, simplified Chinese, Japanese and Korean:

#include <stdio.h>#include <tchar.h>#include <windows.h>void main(void){WCHAR T[2] = {65301, 0};TCHAR dbcs[3], conv[3];WideCharToMultiByte(CP_ACP, 0, T, -1, dbcs, sizeof(dbcs), NULL, NULL);int nRes = LCMapString(LOCALE_USER_DEFAULT, LCMAP_HALFWIDTH,                                                       dbcs,sizeof(dbcs),conv,sizeof(conv));printf("%s\n",conv);}

To make the conversion work for Windows 95 and Windows 98, install one of the four code pages (950 for traditional Chinese, 936 for simplified Chinese, 932 for Japanese and 949 for Korean) on the system and explicitly set the code page and locale ID parameters in the above API calls.

References

For more information about installing a code page, click the following article number to view the article in the Microsoft Knowledge Base:

164948 How to install a code page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.