Skip to content

Commit e3e436c

Browse files
authored
Merge pull request #8102 from magento-gl/AC-7699_23_jan_2023
#AC-7699::DHL shipping method is causing an error-fixed deprecated ut…
2 parents 9200b6a + 5796104 commit e3e436c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
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) {

0 commit comments

Comments
 (0)