Skip to content

Commit

Permalink
MAGETWO-80207: [2.2.x] - Modified Bundle.js because of breaking Encod…
Browse files Browse the repository at this point in the history
…ing in Production Mode. #10563
  • Loading branch information
VladimirZaets committed Oct 4, 2017
1 parent 850b9e5 commit f103832
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 f103832

Please sign in to comment.