Closed NaitoYuki closed 4 years ago
Hi, Thanks for the this library. We are using MWS::Reports::Client.
We are using get_report(request_id) method for _GET_MERCHANT_LISTINGS_ALL_DATA_ report.
get_report(request_id)
_GET_MERCHANT_LISTINGS_ALL_DATA_
some response is the below error. unknown encoding name - UTF8
unknown encoding name - UTF8
28640:E, [2020-03-25T19:50:14.690306 #5105] ERROR -- : unknown encoding name - UTF8 28642-E, [2020-03-25T19:50:14.691057 #5105] ERROR -- : /var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/headers.rb:50:in `find' 28643-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/headers.rb:50:in `content_charset' 28644-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/flat_file_parser.rb:42:in `scrub_body!' 28645-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/flat_file_parser.rb:21:in `initialize' 28646-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/parser.rb:21:in `new' 28647-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/parser.rb:21:in `new' 28648-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/peddler/client.rb:118:in `run' 28649-/var/www/app/shared/bundle/ruby/2.6.0/gems/peddler-2.1.1/lib/mws/reports/client.rb:165:in `get_report'
I found the error is the below. match_data is UTF8. https://github.com/hakanensari/peddler/blob/1e1dde3e597d0ecf1be812468d5001fceb00f59e/lib/peddler/headers.rb#L47
match_data
Seems to me something is the wrong encoding pattern.
So, We are avoiding this error for this patch code.
config/initializers/monkey_patches/flat_file_parser.rb
module Peddler class FlatFileParser < SimpleDelegator def scrub_body!(encoding) return if body.encoding == Encoding::UTF_8 set_charset = content_charset rescue Encoding::UTF_8.to_s self.body = body.dup.force_encoding(set_charset || encoding) end end end
We hope this error will be resolved.
@NaitoYuki Thanks for reporting, I pushed a fix to master
@hakanensari Super Thanks!!!
Hi, Thanks for the this library. We are using MWS::Reports::Client.
We are using
get_report(request_id)
method for_GET_MERCHANT_LISTINGS_ALL_DATA_
report.some response is the below error.
unknown encoding name - UTF8
I found the error is the below.
match_data
is UTF8. https://github.com/hakanensari/peddler/blob/1e1dde3e597d0ecf1be812468d5001fceb00f59e/lib/peddler/headers.rb#L47Seems to me something is the wrong encoding pattern.
So, We are avoiding this error for this patch code.
config/initializers/monkey_patches/flat_file_parser.rb
We hope this error will be resolved.