Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix string with characters not available in database 's codepage although codepage is set

Tags:

wix

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="(株)テイコク" />

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...

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>

UPDATE:

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...

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

Any ideas?

like image 664
yu_ominae Avatar asked Apr 10 '13 01:04

yu_ominae


2 Answers

I had the same problem, but with a "è" char (which is include in CP-1252, so default culture should have worked) . Replacing it by "e" patch the problem but that was not a clean solution.

What really work is adding a .wxl file codepage

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

also precising 1252 worked

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

Then you specify the culture to build according to Wix documentation "Specifying Cultures to Build". It need to be the same culture written in the .wxl file.

enter image description here

Building the project in VS2010 now work.

EDIT: Just adding <Product Codepage="1252" into the .wxs file solved the problem too.

like image 180
Guish Avatar answered Nov 18 '22 10:11

Guish


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.

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.

like image 26
Rob Mensching Avatar answered Nov 18 '22 10:11

Rob Mensching