comparison core/lib/Drupal/Core/Asset/JsOptimizer.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
22 22
23 // If a BOM is found, convert the file to UTF-8, then use substr() to 23 // If a BOM is found, convert the file to UTF-8, then use substr() to
24 // remove the BOM from the result. 24 // remove the BOM from the result.
25 $data = file_get_contents($js_asset['data']); 25 $data = file_get_contents($js_asset['data']);
26 if ($encoding = (Unicode::encodingFromBOM($data))) { 26 if ($encoding = (Unicode::encodingFromBOM($data))) {
27 $data = Unicode::substr(Unicode::convertToUtf8($data, $encoding), 1); 27 $data = mb_substr(Unicode::convertToUtf8($data, $encoding), 1);
28 } 28 }
29 // If no BOM is found, check for the charset attribute. 29 // If no BOM is found, check for the charset attribute.
30 elseif (isset($js_asset['attributes']['charset'])) { 30 elseif (isset($js_asset['attributes']['charset'])) {
31 $data = Unicode::convertToUtf8($data, $js_asset['attributes']['charset']); 31 $data = Unicode::convertToUtf8($data, $js_asset['attributes']['charset']);
32 } 32 }