Share via


About the Microsoft Layer for Unicode

It is desirable to have a single source-code base for Win32-based applications. A common difficulty is that Windows Me/98/95 uses code pages (ANSI) while other versions of Windows use Unicode. A code page severely limits the characters that are available to an application at one time, while Unicode supports the world's major scripts and also full multilingual text.

Current versions of Windows provide both ANSI and Unicode versions of all APIs with string parameters. Thus, an ANSI application can already run on all Windows operating systems. However, this is not ideal because the limitations of code pages typically require extra text processing for ANSI applications.

A better approach is to let Unicode applications run on Windows Me/98/95, which is what the Microsoft Layer for Unicode (MSLU) does. MSLU is a translation layer that provides a complete set of Unicode APIs on Windows Me/98/95. With this, an application can enjoy Unicode language support and eliminate the code page special-casing needed with ANSI applications. When an application calls a supported API, the Microsoft Layer for Unicode converts all strings to ANSI, calls the ANSI version of the API, and then converts all returned strings back into Unicode.

The Microsoft Layer for Unicode is designed around the following ideas:

  • It does not add features. In particular, it provides neither a multilingual environment nor the support for calendars, collation, and formatting for dates, times, and currencies.
  • It does not duplicate existing Unicode support. For example, it generally does not duplicate APIs that already have a Unicode version. And, it does not duplicate components such as Common Controls, Input Method Editor (IME), MultiLanguage Object (MLang), Rich Edit, and Uniscribe. For more information, see Other Existing Unicode Support.
  • It uses the default system code page (CP_ACP) to convert Unicode to ANSI, except for APIs that have an LCID parameter to control this (such as GetLocaleInfo).
  • It does not support Unicode surrogates.
  • Applications do not run any better with the Microsoft Layer for Unicode than without it. The Microsoft Layer for Unicode merely eliminates the need for developers to write their own translation layer. Be sure to test the application on all versions of Windows your application supports, because the behavior may differ.
  • Other specific limitations are noted in the Limitations of the Microsoft Layer for Unicode, the Microsoft Layer for Unicode Reference, and in the documentation for specific APIs.