diff options
3 files changed, 10 insertions, 3 deletions
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 | |||
172 | /// <exception cref="WixException">The code page is invalid for summary information.</exception> | 172 | /// <exception cref="WixException">The code page is invalid for summary information.</exception> |
173 | public static int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null) | 173 | public static int GetValidCodePage(string value, bool allowNoChange = false, bool onlyAnsi = false, SourceLineNumber sourceLineNumbers = null) |
174 | { | 174 | { |
175 | Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); | ||
176 | |||
175 | try | 177 | try |
176 | { | 178 | { |
177 | Encoding encoding; | 179 | Encoding encoding; |
@@ -190,7 +192,7 @@ namespace WixToolset.Core | |||
190 | return -1; | 192 | return -1; |
191 | } | 193 | } |
192 | 194 | ||
193 | encoding = CodePagesEncodingProvider.Instance.GetEncoding(codePage); | 195 | encoding = Encoding.GetEncoding(codePage); |
194 | } | 196 | } |
195 | else | 197 | else |
196 | { | 198 | { |
@@ -208,6 +210,11 @@ namespace WixToolset.Core | |||
208 | } | 210 | } |
209 | } | 211 | } |
210 | 212 | ||
213 | if (encoding == null) | ||
214 | { | ||
215 | throw new WixException(ErrorMessages.IllegalCodepage(sourceLineNumbers, codePage)); | ||
216 | } | ||
217 | |||
211 | return encoding.CodePage; | 218 | return encoding.CodePage; |
212 | } | 219 | } |
213 | catch (ArgumentException ex) | 220 | 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 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | 3 | <Product Id="*" Name="MsiPackage" Codepage="1252" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> |
4 | <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" /> | 4 | <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" /> |
5 | 5 | ||
6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | 6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> |
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 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | 3 | <Product Id="*" Name="MsiPackage" Codepage="65001" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> |
4 | <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> | 4 | <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> |
5 | 5 | ||
6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | 6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> |