diff --git a/src/Manifest.js b/src/Manifest.js index 49906b1..0840d38 100644 --- a/src/Manifest.js +++ b/src/Manifest.js @@ -244,6 +244,15 @@ function Manifest(output, path) { } } + // Windows codepage + // Optional field, only check if present. + this._windowsCodepage = ""; + if (json.xwalk_windows_codepage) { + this._windowsCodepage = json.xwalk_windows_codepage; + } else { + this._windowsCodepage = Manifest.WINDOWS_DEFAULT_CODEPAGE; + } + // Windows update ID // Optional field, only check if present. this._windowsUpdateId = null; @@ -282,6 +291,13 @@ function Manifest(output, path) { */ Manifest.ANDROID_DEFAULT_PERMISSIONS = [ "ACCESS_NETWORK_STATE", "ACCESS_WIFI_STATE", "INTERNET" ]; +/** + * Default codepage to use is "western european". + * When using ISO 8859-1 unsupported characters in the manifest, + * the codepage needs to be adjusted accordingly. + */ +Manifest.WINDOWS_DEFAULT_CODEPAGE = "1252"; + /** * Create default manifest data. * @param {String} packageId Unique package identifier com.example.foo @@ -332,6 +348,7 @@ function(packageId) { // Set external storage by default, needed for shared mode/fallback. "xwalk_android_permissions": Manifest.ANDROID_DEFAULT_PERMISSIONS, // Windows fields + "xwalk_windows_codepage": Manifest.WINDOWS_DEFAULT_CODEPAGE, "xwalk_windows_update_id": windowsUpdateId }; }; @@ -670,6 +687,18 @@ Object.defineProperty(Manifest.prototype, "targetPlatforms", { } }); +/** + * Windows codepage + * @member {String} windowsCodepage + * @instance + * @memberOf Manifest + */ +Object.defineProperty(Manifest.prototype, "windowsCodepage", { + get: function() { + return this._windowsCodepage; + } + }); + /** * Windows update ID * @member {String} windowsUpdateId diff --git a/test/manifest.js b/test/manifest.js index 34f79bb..f7243f9 100644 --- a/test/manifest.js +++ b/test/manifest.js @@ -413,6 +413,28 @@ exports.tests = { test.done(); }, + windowsCodepageDefault: function(test) { + + test.expect(1); + + var path1 = produceManifest(); + var m1 = consumeManifest(path1); + + test.equal(m1.windowsCodepage, Manifest.WINDOWS_DEFAULT_CODEPAGE); + test.done(); + }, + + windowsCodepageCustom: function(test) { + + test.expect(1); + + var path1 = produceManifest({xwalk_windows_codepage: "936"}); + var m1 = consumeManifest(path1); + + test.equal(m1.windowsCodepage, "936"); + test.done(); + }, + windowsUpdateId: function(test) { test.expect(1); diff --git a/windows/lib/WixSDK.js b/windows/lib/WixSDK.js index c53ad89..c8e10c0 100644 --- a/windows/lib/WixSDK.js +++ b/windows/lib/WixSDK.js @@ -118,7 +118,8 @@ function(app_path, xwalk_path, meta_data, callback) { 'UpgradeCode': meta_data.upgrade_id, 'Version': meta_data.version, 'Manufacturer': meta_data.manufacturer, - 'Language': '1033' + 'Language': '1033', + 'Codepage': this._manifest.windowsCodepage }); var package = product.ele('Package', { InstallerVersion: '300', 'Compressed': 'yes' });