虽然设置了代码页,但是Wix字符串中包含数据库代码页中没有的字符

yu_*_*nae 5 wix

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

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.
Run Code Online (Sandbox Code Playgroud)

第一个发生在以下行:

<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
         Manufacturer="(?)????" />
Run Code Online (Sandbox Code Playgroud)

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

<Product Id="*" Codepage="932" Language="1041"
         Name="????????????????????????" Version="1.1.0.0"
         Manufacturer="(?)????" UpgradeCode="PUT-GUID-HERE">
Run Code Online (Sandbox Code Playgroud)

我真的不知道错误是什么或如何解决它,特别是因为这几天前工作正常...

如果需要,这里是完整的Wix代码:

<?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>
Run Code Online (Sandbox Code Playgroud)

更新:

用代码页1252中的字符替换每个日语字符都可以正常工作.似乎Wix忽略了代码页规范并使用默认的1252而不是......

我也在一个新的wix安装项目中尝试了这个并且遇到了同样的问题.

有任何想法吗?

Gui*_*ish 8

我有同样的问题,但有一个"è"字符(包含在CP-1252中,所以默认文化应该有效).用"e"替换它可以解决问题,但这不是一个干净的解决方案.

真正有用的是添加.wxl文件代码页

<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Codepage="utf-8" Culture="fr-ca" xmlns="http://schemas.microsoft.com/wix/2006/localization">
</WixLocalization>
Run Code Online (Sandbox Code Playgroud)

同样精确1252工作

<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Codepage="1252" Culture="fr-ca" xmlns="http://schemas.microsoft.com/wix/2006/localization">
</WixLocalization>
Run Code Online (Sandbox Code Playgroud)

然后根据Wix文档"指定要构建的文化"指定要构建的文化.它必须是.wxl文件中编写的相同文化.

在此输入图像描述

在VS2010中构建项目现在可以正常工作.

编辑:只需添加<Product Codepage="1252"到.wxs文件中也可以解决问题.

  • 在我的项目中,我仅将 Codepage="utf-8" 添加到我的法语本地化文件(此答案中的第一个代码示例)并且它有效。不需要指定文化来构建。根据我的理解,当你正在开发并且不想建立你拥有的所有文化时,指定文化是好的...... (2认同)

Rob*_*ing 4

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

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