diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index bc63247e0..77433e6d6 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs @@ -867,12 +867,12 @@ public static Message IllegalCharactersInPath(string pathName) public static Message IllegalCodepage(int codepage) { - return Message(null, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.", codepage); + return Message(null, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", codepage); } public static Message IllegalCodepage(SourceLineNumber sourceLineNumbers, int codepage) { - return Message(sourceLineNumbers, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.", codepage); + return Message(sourceLineNumbers, Ids.IllegalCodepage, "The code page '{0}' is not a valid Windows code page. Update the database's code page by modifying one of the following attributes: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", codepage); } public static Message IllegalCodepageAttribute(SourceLineNumber sourceLineNumbers, string codepage, string elementName, string attributeName) @@ -1318,7 +1318,7 @@ public static Message InvalidSequenceTable(string sequenceTableName) public static Message InvalidStringForCodepage(SourceLineNumber sourceLineNumbers, string codepage) { - return Message(sourceLineNumbers, Ids.InvalidStringForCodepage, "A string was provided with characters that are not available in the specified database code page '{0}'. 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: Package/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage.", codepage); + return Message(sourceLineNumbers, Ids.InvalidStringForCodepage, "A string was provided with characters that are not available in the specified database code page '{0}'. 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: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", codepage); } public static Message InvalidStubExe(string filename) diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs index 89fc81dbf..28bcfd4a4 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/CreateIdtFileCommand.cs @@ -81,7 +81,7 @@ private void TableToIdtDefinition(Table table, StreamWriter writer, bool keepAdd } catch (EncoderFallbackException) { - this.Messaging.Write(ErrorMessages.InvalidStringForCodepage(row.SourceLineNumbers, Convert.ToString(writer.Encoding.WindowsCodePage, CultureInfo.InvariantCulture))); + this.Messaging.Write(ErrorMessages.InvalidStringForCodepage(row.SourceLineNumbers, Convert.ToString(writer.Encoding.CodePage, CultureInfo.InvariantCulture))); rowBytes = convertEncoding.GetBytes(rowString); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs new file mode 100644 index 000000000..f02cba75e --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/EncodingFixture.cs @@ -0,0 +1,44 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolsetTest.CoreIntegration +{ + using System.IO; + using System.Linq; + using WixInternal.Core.TestPackage; + using WixInternal.TestSupport; + using WixToolset.Data; + using Xunit; + + public class EncodingFixture + { + [Fact] + public void PopulatesAppIdTableWhenAdvertised() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin", "test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Encoding", "Encoding.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + var errors = result.Messages.Where(m => m.Level == MessageLevel.Error).Select(m => m.ToString().Replace(folder, "")).ToArray(); + WixAssert.CompareLineByLine(new[] + { + "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: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", + "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: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", + "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: Package/@Codepage, Module/@Codepage, Patch/@Codepage, or WixLocalization/@Codepage.", + }, errors); + } + } + } +} diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs new file mode 100644 index 000000000..94ca33b32 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Encoding/Encoding.wxs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +