python-amazon-sp-api icon indicating copy to clipboard operation
python-amazon-sp-api copied to clipboard

Fix create_feed_document upload encoding

Open paulvoe opened this issue 1 year ago • 3 comments

Hi,

I had trouble uploading POST_FLAT_FILE_LISTINGS_DATA Feeds with the create_feed_document method to the Amazon Germany marketplace that contained special German characters (ä,ö,ü,ß). The encoding of the characters that arrived at Amazon seemed wrong, even though the ISO-8859-1 encoding should be correct. I'm not 100% sure if my code change is correct in all cases, but it did the trick for me.
Decoding in that place seems wrong to me, because it converts already encoded upload data back to str, which is then uploaded with the default encoding of requests which I think is UTF-8, which Amazon cannot handle.

Thanks for the great library!

paulvoe avatar Feb 01 '24 21:02 paulvoe

Hi,

thanks for the PR!

Did you test this with other marketplaces than DE? I'm afraid it will break things for others, happy to try over the weekend.

saleweaver avatar Feb 01 '24 21:02 saleweaver

I tested it with Amazon US and had no issues. However, for US, it also worked for me before because there were never any special characters in those uploads, which makes it a bit meaningless I guess.

Unfortunately I don't have any listings on other marketplaces

paulvoe avatar Feb 01 '24 22:02 paulvoe

Got it. Thanks for that. I'll have a look the next couple of days, I think it will keep working after looking over it more.

saleweaver avatar Feb 01 '24 22:02 saleweaver

Can confirm we have the same problem and this solutions seems to fix it. @saleweaver Is there a chance to get this merged?

PH89 avatar Mar 18 '24 13:03 PH89

Sorry, thought I did that some time ago... just merged, will add a release tonight

saleweaver avatar Mar 18 '24 13:03 saleweaver