From 38b6fe65e36ed9442e3fc714dea1793d457f0b20 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Thu, 6 Sep 2018 20:33:40 -0400 Subject: Fix codepage handling to cover both Framework- and Core- supported code pages. --- src/WixToolset.Core/Common.cs | 9 ++++++++- .../TestData/SingleFile/Package.wxs | 2 +- .../TestData/SingleFileCompressed/Package.wxs | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Core/Common.cs b/src/WixToolset.Core/Common.cs index ebcbd36f..2d8f9509 100644 --- a/src/WixToolset.Core/Common.cs +++ b/src/WixToolset.Core/Common.cs @@ -172,6 +172,8 @@ namespace WixToolset.Core /// The code page is invalid for summary information. public static int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null) { + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + try { Encoding encoding; @@ -190,7 +192,7 @@ namespace WixToolset.Core return -1; } - encoding = CodePagesEncodingProvider.Instance.GetEncoding(codePage); + encoding = Encoding.GetEncoding(codePage); } else { @@ -208,6 +210,11 @@ namespace WixToolset.Core } } + if (encoding == null) + { + throw new WixException(ErrorMessages.IllegalCodepage(sourceLineNumbers, codePage)); + } + return encoding.CodePage; } catch (ArgumentException ex) diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs index cdc323ec..6da3dcbe 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFile/Package.wxs @@ -1,6 +1,6 @@ - + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs index 0b743c81..8bb1f6af 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs @@ -1,6 +1,6 @@ - + -- cgit v1.2.3-55-g6feb