尽管设置了代码页,但具有数据库代码页中不可用字符的 Wix 字符串 [英] Wix string with characters not available in database 's codepage although codepage is set

查看:22
本文介绍了尽管设置了代码页,但具有数据库代码页中不可用字符的 Wix 字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VS2012 中有一个 Wix 安装程序项目,我上次使用它时(大约一周前)编译得很好.我今天回去发现了大约 15 个代码页错误:

I have a Wix installer project in VS2012, which compiled just fine last time I used it (about a week ago). I went back today and get about 15 code page errors:

Error   6   A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.

第一个出现在以下行中:

The first of these occurs on the following line:

<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
         Manufacturer="(株)テイコク" />

而且我认为 wix 不高兴是因为日文字符.然而在产品声明中,我将代码页设置为 932,这对于日语来说应该是正确的:

And I assume that wix is unhappy because of the Japanese characters. Yet in the product declaration I am setting the Codepage to 932, which should be correct for Japanese:

<Product Id="*" Codepage="932" Language="1041"
         Name="各務原市農地支援・畑地管理システムインストーラー" Version="1.1.0.0"
         Manufacturer="(株)テイコク" UpgradeCode="PUT-GUID-HERE">

我真的不明白错误是什么或如何解决它,特别是因为几天前它运行良好......

I really don't get what the error is or how to resolve it, especially since this worked fine a few days ago...

以下是完整的 Wix 代码,以备不时之需:

Here's the full Wix code in case it's needed:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:net="http://schemas.microsoft.com/wix/NetFxExtension">
  <Product Id="*" Codepage="932" Language="1041" Name="各務原市農地支援・畑地管理システムインストーラー" Version="1.1.0.0" Manufacturer="(株)テイコク" UpgradeCode="PUT-GUID-HERE">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Manufacturer="(株)テイコク" />

    <UIRef Id="WixUI_Minimal" />
    <UIRef Id="WixUI_ErrorProgressText" />

    <PropertyRef Id="NETFRAMEWORK40CLIENT" />
    <Condition Message="インストールするには.NETフレームワーク4.0が必要です。フレームワークをインストールしてからもう一度インストーラーを実行してください。">
      <![CDATA[Installed OR NETFRAMEWORK40CLIENT]]>
    </Condition>

    <MajorUpgrade DowngradeErrorMessage="もっと新しいバージョンが既にインストールされています。" />
    <MediaTemplate EmbedCab="yes" />

    <Feature Id="ProductFeature" Title="MapManagerInstaller" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <Icon Id="MapManager.exe" SourceFile="MapManager.exe" />
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="各務原市農地支援・畑地管理システム" />
      </Directory>
      <Directory Id="DesktopFolder" Name="Desktop">
      </Directory>
      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id ="ProgramMenuDir" Name="各務原市農地支援・畑地管理システム">
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="MapManagerProgramFiles" Guid="*">
        <File Id="MapManagerExe" Name ="MapManager.exe">
          <Shortcut Id="MapManagerDesktopShortcut" Directory="DesktopFolder" Name="各務原市農地支援・畑地管理システム" WorkingDirectory="INSTALLFOLDER" Icon="MapManager.exe" IconIndex="0" Advertise="yes" />
          <Shortcut Id="MapManagerStartMenuShortcut" Directory="ProgramMenuDir" Name="各務原市農地支援・畑地管理システム" WorkingDirectory="INSTALLFOLDER" Icon="MapManager.exe" IconIndex="0" Advertise="yes" />
        </File>
        <File Id="AxInterop.SisLib" Name="AxInterop.SisLib.dll" />
        <File Id="Interop.SisLib" Name="Interop.SisLib.dll" />
        <File Id="ClassMap" Name="ClassMap.dll" />
        <File Id="SuidenManager" Name="SuidenManager.dll" />
        <File Id="HatachiManager" Name="HatachiManager.dll" />
        <File Id="MapManagerShared" Name="MapManagerShared.dll" />
        <RemoveFolder Id="INSTALLDIR" On="uninstall" />
      </Component>
      <Component Id="DesktopShortcut" Guid="*">
        <Shortcut Id="DesktopShortcut" Name="各務原市農地支援・畑地管理システム" Target="[INSTALLFOLDER]MapManager.exe" WorkingDirectory="INSTALLFOLDER" />
        <RemoveFolder Id="DesktopFolder" On ="uninstall" />
        <RegistryValue Root="HKCU" Key="Software\MapMax\各務原市農地支援・畑地管理システム" Type="string" Value="" KeyPath="yes" />
      </Component>
      <Component Id="ProgramMenuDir" Guid="*">
        <RemoveFolder Id="ProgramMenuDir" On ="uninstall" />
        <RegistryValue Root="HKCU" Key="Software\MapMax\各務原市農地支援・畑地管理システム" Type="string" Value="" KeyPath="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

更新:

用代码页 1252 中的字符替换每个日文字符工作正常.似乎 Wix 忽略了代码页规范,而是使用默认的 1252 一个......

Replacing every single Japanese character with a character from code page 1252 works fine. Seems that Wix is ignoring the code page specification and using the default 1252 one instead...

我也在一个新的 wix 设置项目中尝试过这个,但遇到了同样的问题.

I've also tried this in a new wix setup project and am getting the same problem.

有什么想法吗?

推荐答案

如果您使用 .wxl 文件,这些文件可以在构建期间覆盖代码页.确保您的 .wxl 文件都为它们添加的字符设置了正确的代码页,并且您最终不会将来自不同代码页的字符与您的产品和从 .wxl 文件本地化的字符串混合在一起.

If you are using .wxl files, those can override the codepage during the build. Ensure that your .wxl files all have the correct codepage set for the characters they are adding and that you don't end up mixing characters from different codepages with your product and strings localized from a .wxl file.

此外,由于您使用的是 WixUI,因此它们也包含许多带有代码页的 .wxl 文件.在 WiX.chm 中有一个标题为 "Specifying Cultures to Build" 的主题.这向您展示了如何设置代码页以在 Votive 中构建.具体来说,您需要将ja-JP"(或其他适当的文化)添加到 Cultures to build: 设置 .wixproj 的 Properties.否则,您可能会从 WixUI 获得默认文化,这可能是美国版,这可以解释 1252 解决方法.

Additionally, since you are using the WixUI those contain many .wxl files with codepages in them as well. In the WiX.chm there is a topic titled "Specifying Cultures to Build". That shows you how to set the codepages to build in Votive. Specifically, you'll want to add "ja-JP" (or other appropriate culture) to the Cultures to build: setting the Properties of your .wixproj. Otherwise, you're probably getting the default culture from the WixUI which is probably en-US and that would explain the 1252 workaround.

这篇关于尽管设置了代码页,但具有数据库代码页中不可用字符的 Wix 字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆