Skip to content

Commit

Permalink
MAGETWO-71647: Modified Bundle.js because of breaking Encoding in Pro…
Browse files Browse the repository at this point in the history
…duction Mode. #10563
  • Loading branch information
ishakhsuvarov authored Aug 31, 2017
2 parents 5858ca5 + ee97dcb commit 03d99c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions app/code/Magento/Deploy/Package/Bundle/RequireJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,12 @@ private function endBundleFile(WriteInterface $bundleFile, array $contents)
private function getFileContent($sourcePath)
{
if (!isset($this->fileContent[$sourcePath])) {
$this->fileContent[$sourcePath] = utf8_encode(
$this->staticDir->readFile($this->minification->addMinifiedSign($sourcePath))
);
$content = $this->staticDir->readFile($this->minification->addMinifiedSign($sourcePath));
if (mb_detect_encoding($content) !== "UTF-8") {
$content = mb_convert_encoding($content, "UTF-8");
}

$this->fileContent[$sourcePath] = $content;
}
return $this->fileContent[$sourcePath];
}
Expand Down
6 changes: 5 additions & 1 deletion lib/internal/Magento/Framework/View/Asset/Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ protected function getAssetContent(LocalInterface $asset)
$assetContentType = $asset->getContentType();
$assetKey = $this->getAssetKey($asset);
if (!isset($this->assetsContent[$assetContextCode][$assetContentType][$assetKey])) {
$this->assetsContent[$assetContextCode][$assetContentType][$assetKey] = utf8_encode($asset->getContent());
$content = $asset->getContent();
if (mb_detect_encoding($content) !== "UTF-8") {
$content = mb_convert_encoding($content, "UTF-8");
}
$this->assetsContent[$assetContextCode][$assetContentType][$assetKey] = $content;
}

return $this->assetsContent[$assetContextCode][$assetContentType][$assetKey];
Expand Down

0 comments on commit 03d99c5

Please sign in to comment.