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

Setting the Code Page of a Database

· 52CE 我爱测

Always set the code page of a database prior to adding any localization information.

Always set the code page of a database prior to adding any localization information. Attempting to set the code page after entering data into the database is not recommended because this could corrupt extended characters. Localization can be greatly facilitated by starting with a database that is code page neutral. For details, see Creating a database with a neutral code page. You may determine the current code page of a database as described in Determining an installation database's code page. See Localizing the Error and ActionText Tables for a list of numeric code pages.

You may set the code page of a blank database, or a database with a neutral code page, by importing a text archive file having a non-neutral code page with MsiDatabaseImport. This sets the code page of the database to the imported file's code page. All archive files subsequently imported into the database must then have the same code page as the first file. If a text archive file is exported from a database, the code page of the archive file is the same as the parent database. See Code Page Handling of Imported and Exported Tables.

The code page of any database may be set to a specified numeric code page by using MsiDatabaseImport to import a text archive file with the following format: Two blank lines; followed by a line containing the numeric code page, a tab delimiter, and the exact string: _ForceCodepage. Note that with Windows 2000, this translates all of the strings in the database to the code page of _ForceCodepage. This may be intended when localizing an existing database and translating all non-neutral strings to the new code page. However, this causes an error if the database contains non-neutral strings that are not to be translated.

The utility WiLangId.vbs provides an example of how to set the code page of a package using the Import method. A copy of WiLangId.vbs is provided in the Windows Installer SDK. You can use this utility to determine the language versions that are supported by the database (Package), the language the installer uses for any strings in the user interface that are not authored into the database (Product), or the single ANSI code page for the string pool (Codepage). For information on using WiLangId.vbs see the help page: Manage Language and Codepage.

To determine the values of Product, Package, and Codepage, run WiLangId.vbs as follows.

cscript wilangid.vbs [path to database]

To set the Codepage of the package run the following command line.

cscript wilangid.vbs [path to database] Codepage [value]

For example, to set the Codepage of test.msi to the numeric ANSI code page value 1252, run the following command line.

cscript wilangid.vbs c:\temp\test.msi Codepage 1252

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)

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

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