Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accents in SKU / Name - Not decoded #64

Closed
jesusvalle opened this issue Oct 23, 2018 · 9 comments
Closed

Accents in SKU / Name - Not decoded #64

jesusvalle opened this issue Oct 23, 2018 · 9 comments
Assignees

Comments

@jesusvalle
Copy link

Greetings. I've noticed that when i request and get the items from a report listing (for example, merchant report), some sku's have accents in it, but not decoded. Example:

"Champú anticaspa" --> "Champ� anticaspa".

In seller central it's displayed properly. This it's happening with product-names too when i get merchant report items.

I've tried decoding the XML in my javascript, but without results.

Thanks so much.

@marcospampi
Copy link
Contributor

marcospampi commented Oct 23, 2018

What's the request you're making against amazon? It is a known issue we encountered in flat files against the charset, not xmls (xml uses UTF8). Try using the __RAW__ option to get the Buffer object,that you can save with fs.writeFile and help us solve the issue.

@bhushankummar
Copy link
Owner

@jesusvalle
Copy link
Author

jesusvalle commented Oct 23, 2018

EDITED

@jesusvalle
Copy link
Author

In my file, I'm calling search function like this:

.search({
                    Action: 'GetReport',
                    MWSAuthToken: this.amzAccountData.MWSAuthToken,
                    ReportId: requestedReportId,
                    SellerId: this.amzAccountData.sellerId,
                    Version: '2009-01-01',
                    // __RAW__: true
                    __CHARSET__: 'ISO-8859-1'
                })

And in amazonMwsResource, i only decode (not encode) the bufferString with the charset sended by param.

 if (userOptions.userCharset && userOptions.userCharset.length > 0) {
                    debug('Inside user Charset option');
                    charset = userOptions.userCharset;
                    try {
                        responseString = iconv.decode(bufferString, charset);
                    } catch (Exception) {
                        debug('Exception iconv ', Exception);
                        return callback.call(self, new Error.AmazonMwsAPIError({
                            message: 'Failed to parse response received from the AmazonMws API',
                            StatusCode: statusCode || 'unknown'
                        }), null);
                    }
                } else {
                    responseString = bufferString.toString();
                }

Decoding to ISO-8859-1, now i can see all the accents in my report result.

@jesusvalle
Copy link
Author

¿You will update the package with those changes in amazazonMwsResource file?

@bhushankummar
Copy link
Owner

@jesusvalle Yes

@bhushankummar bhushankummar reopened this Oct 25, 2018
@bhushankummar bhushankummar self-assigned this Oct 25, 2018
@bhushankummar
Copy link
Owner

Fixed in #66

@jesusvalle
Copy link
Author

Thanks so much.

@bhushankummar
Copy link
Owner

@jesusvalle Release in latest version https://www.npmjs.com/package/amazon-mws

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants