Skip to content

Commit 8b952d8

Browse files
committed
Merge branch 'AC-7850' of github.com:magento-gl/magento2ce into AC-7850
2 parents 94938d9 + df4f2d4 commit 8b952d8

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ protected function _getQuotes()
10471047
(string)$this->getConfigData('gateway_url'),
10481048
Request::METHOD_POST,
10491049
['Content-Type' => 'application/xml'],
1050-
utf8_encode($request)
1050+
mb_convert_encoding($request, 'UTF-8')
10511051
)
10521052
),
10531053
'date' => $date,
@@ -1105,7 +1105,7 @@ protected function _getQuotesFromServer($request)
11051105
$client = $this->_httpClientFactory->create();
11061106
$client->setUri($this->getGatewayURL());
11071107
$client->setOptions(['maxredirects' => 0, 'timeout' => 30]);
1108-
$client->setRawBody(utf8_encode($request));
1108+
$client->setRawBody(mb_convert_encoding($request, 'UTF-8'));
11091109
$client->setMethod(HttpRequest::METHOD_POST);
11101110

11111111
return $client->send()->getBody();
@@ -1716,7 +1716,7 @@ protected function _doRequest()
17161716

17171717
$request = $xml->asXML();
17181718
if ($request && !(mb_detect_encoding($request) == 'UTF-8')) {
1719-
$request = utf8_encode($request);
1719+
$request = mb_convert_encoding($request, 'UTF-8');
17201720
}
17211721

17221722
$responseBody = $this->_getCachedQuotes($request);
@@ -1731,7 +1731,7 @@ protected function _doRequest()
17311731
$request
17321732
)
17331733
);
1734-
$responseBody = utf8_decode($response->get()->getBody());
1734+
$responseBody = mb_convert_encoding($response->get()->getBody(), 'ISO-8859-1', 'UTF-8');
17351735
$debugData['result'] = $this->filterDebugData($responseBody);
17361736
$this->_setCachedQuotes($request, $responseBody);
17371737
} catch (\Exception $e) {
@@ -1880,7 +1880,7 @@ protected function _getXMLTracking($trackings)
18801880
//$xml->addChild('PiecesEnabled', 'ALL_CHECK_POINTS');
18811881

18821882
$request = $xml->asXML();
1883-
$request = utf8_encode($request);
1883+
$request = mb_convert_encoding($request, 'UTF-8');
18841884

18851885
$responseBody = $this->_getCachedQuotes($request);
18861886
if ($responseBody === null) {

composer.lock

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/tests/integration/testsuite/Magento/Dhl/Model/CarrierTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public function testRequestToShip(
286286
new Response(
287287
200,
288288
[],
289-
utf8_encode(file_get_contents(__DIR__ . '/../_files/response_shipping_label.xml'))
289+
mb_convert_encoding(file_get_contents(__DIR__ . '/../_files/response_shipping_label.xml'), 'UTF-8')
290290
)
291291
]
292292
);

0 commit comments

Comments
 (0)