diff --git a/.gitignore b/.gitignore index a62ef6c..ae8bf52 100644 --- a/.gitignore +++ b/.gitignore @@ -75,4 +75,5 @@ node_modules/ .tmp/* npm-debug.log npm-debug.log/* -package-lock.json \ No newline at end of file +package-lock.json +response.txt \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 093e67a..a4d7304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +0.0.23 + - Bug Fix for Feed Result charset + 0.0.22 - Bug Fix Default value for XML parsing - Add Support for the Subscription APIs, Recommendations API diff --git a/examples/javaScript/feeds/getFeedSubmissionResultCharset.js b/examples/javaScript/feeds/getFeedSubmissionResultCharset.js index 97528ca..0524cf0 100644 --- a/examples/javaScript/feeds/getFeedSubmissionResultCharset.js +++ b/examples/javaScript/feeds/getFeedSubmissionResultCharset.js @@ -4,11 +4,10 @@ var accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY'; var accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET'; var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret); -var fse = require('fs-extra'); /** * Use __CHARSET__ to override charset option.; - * This along with __RAW__ do not get written in the request. + * This along with __RAW__ do NOT get written in the request. * */ function feedRequest() { var FeedSubmissionId = '10101010XXX'; @@ -18,14 +17,14 @@ function feedRequest() { 'SellerId': 'SELLER_ID', 'MWSAuthToken': 'MWS_AUTH_TOKEN', 'FeedSubmissionId': FeedSubmissionId, - __CHARSET__: 'latin1' + // __CHARSET__: 'latin1' + __CHARSET__: 'ISO-8859-1' }, function (error, response) { if (error) { console.log('error ', error); return; } - fse.writeFileSync('response.txt', response.data); - console.log('Headers', response.Headers); + console.log('response ', JSON.stringify(response)); }); } diff --git a/lib/AmazonMwsResource.js b/lib/AmazonMwsResource.js index 7567807..d1e9164 100644 --- a/lib/AmazonMwsResource.js +++ b/lib/AmazonMwsResource.js @@ -277,11 +277,7 @@ AmazonMwsResource.prototype = { debug('Inside user Charset option'); charset = userOptions.userCharset; try { - /** - * https://github.com/ashtuchkin/iconv-lite/issues/32 - */ - var win1251String = iconv.decode(bufferString, 'win1251'); - responseString = iconv.encode(win1251String, charset); + responseString = iconv.decode(bufferString, charset); } catch (Exception) { debug('Exception iconv ', Exception); return callback.call(self, new Error.AmazonMwsAPIError({ @@ -336,7 +332,7 @@ AmazonMwsResource.prototype = { } // debug('response', response); try { - ResponseMetadata = response.ResponseMetadata; + ResponseMetadata = response.ResponseMetadata || {}; } catch (exception) { debug('exception', exception); ResponseMetadata = {}; diff --git a/package.json b/package.json index ccee075..42e1aef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amazon-mws", - "version": "0.0.22", + "version": "0.0.23", "description": "Amazon MWS API wrapper", "keywords": [ "Amazon MWS",