From 653a1ad2b2f98515d15d607b45a636cd0b310ea0 Mon Sep 17 00:00:00 2001 From: Eric Jensen Date: Tue, 11 Oct 2022 14:57:53 -0400 Subject: [PATCH] fix readme for encoding --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e8b33476..a9b5e3a8a 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,10 @@ response = feeds.get_feed(response.feed_id) result_feed_document_id = response.result_feed_document_id # present once it is successful response = feeds.get_feed_document(result_feed_document_id) # GET response.url into compressed, again it's pre-signed so no authorization needed -AmzSpApi.inflate_document(compressed, response) +report = AmzSpApi.inflate_document(compressed, response) +# you should capture the HTTP headers from downloading url as well since it's often Cp1252 +report.force_encoding($1) if headers['Content-Type'] =~ /charset *= *([^;]+)/ +CSV.parse(report, headers: true, col_sep: "\t", liberal_parsing: true) # if it's a CSV report type ``` ## Thanks