大网数据广告活动
安装更新与部署

Code Page Handling of Parameter Strings

· 52CE 我爱测

You can add localization information to an installation database by using a database table editor such as Orca that is provided with the Windows Installer SDK, or by calling the Database Functions from an application.

You can add localization information to an installation database by using a database table editor such as Orca that is provided with the Windows Installer SDK, or by calling the Database Functions from an application. Be careful to only pass string parameters that use the code page of the database that is being localized. If a string parameter contains characters that cannot be represented by the code page of the database, the Installer returns an error when calling MsiDatabaseImport. For a list of numeric code pages, see Localizing the Error and ActionText Tables.

For more information, see Determining an Installation Database's Code Page.

Adding Localization Information to a Database

When you add localization information to a database, the code page of the database must be supported by the operating system. It does not have to be the current code page of the system. IsValidCodePage must return TRUE for the database code page. Because the system converts ANSI strings to Unicode, there is an error if the current user code page is not the same as the database code page.

Calling the ANSI version of the Windows Installer API converts the localized string to Unicode by using the current system code page. When the database is committed, the Unicode string is converted to ANSI using the code page of the database. If the current system code page differs from the code page of the localized string, the result can be a loss of data and incorrect string conversion.

The following procedure shows you how to store the localization data.

To store localization data

  1. Set the code page of the database to the code page of the localized string.
  2. Convert the ANSI string to Unicode by using the MultiByteToWideChar function, and specify the code page of the localized data.
  3. Call the Unicode version of the Windows Installer API by using the Unicode string to add the localized data.
  4. Commit the localization changes to the database by using MsiDatabaseCommit.

You can also add localization information to an installation database by importing and exporting ASCII text archive files. For more information, see Code Page Handling of Imported and Exported Tables.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。