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

Encoding parameter for Document class (2 issues) #340

Closed
0xSekar opened this issue Jul 22, 2022 · 3 comments
Closed

Encoding parameter for Document class (2 issues) #340

0xSekar opened this issue Jul 22, 2022 · 3 comments

Comments

@0xSekar
Copy link
Contributor

0xSekar commented Jul 22, 2022

In this block,

if (!is_null($encoding) && !in_array(strtoupper($encoding), mb_list_encodings())) {
$encoding = null;
} else {
$encodings = ['UTF-8'];
if ($response->hasHeader('content-type')) {
$httpContentType = $response->getHeader('content-type');
$parsedHeader = \GuzzleHttp\Psr7\Header::parse($httpContentType);
if (isset($parsedHeader[0]['charset'])) {
array_unshift($encodings, $parsedHeader[0]['charset']);
}
}
$encoding = mb_detect_encoding($contents, $encodings, true);

if encoding is passed and is valid, the if at line 126 is false so the else is executed, overriding the encoding parameter with the encoding in the response header. I think that if the parameter is passed and valid, it must override the one from the response.

Second problem is the Content-type response from Amazon for some reports in Europe. Instead of ISO-8859-1, amazon is sending Cp1252 that is not in the list of supported php encodings, rendering the auto-detect feature useless for some EU reports.

@quazardous
Copy link
Contributor

Is it related to #336 ?

@0xSekar
Copy link
Contributor Author

0xSekar commented Jul 25, 2022

Is it related to #336 ?

I Don't think it is directly related. Similar issues, but one is for downloads while the other is for upload

@jlevers
Copy link
Owner

jlevers commented Jul 26, 2022

fixed in v5.2.1.

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