iconv(): Wrong charset, conversion from `utf-32le` to `utf-8` is not allowed
Schrank opened this issue · comments
I don't understand why and I am not able to reproduce this issue on our staging server (it happens on the production system). But maybe someone else has more knowledge about all this than me.
12:34:45 WARNING [php] Notice: iconv(): Wrong charset, conversion from `utf-32le' to `utf-8' is not allowed
[
"exception" => ErrorException {
#message: "Notice: iconv(): Wrong charset, conversion from `utf-32le' to `utf-8' is not allowed"
#code: 0
#file: "/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/ParserState.php"
#line: 91
#severity: E_NOTICE
trace: {
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/ParserState.php:91 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CSSString.php:37 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Value.php:90 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Value.php:36 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Rule/Rule.php:39 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/RuleSet.php:35 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php:33 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php:98 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php:49 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/Document.php:21 { …}
/web/releases/20210916164447/vendor/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parser.php:38 { …}
/web/releases/20210916164447/vendor/shopware/storefront/Theme/Autoprefixer.php:31 { …}
/web/releases/20210916164447/vendor/shopware/storefront/Theme/ThemeCompiler.php:224 { …}
/web/releases/20210916164447/vendor/shopware/storefront/Theme/ThemeCompiler.php:127 { …}
/web/releases/20210916164447/vendor/shopware/storefront/Theme/ThemeService.php:68 { …}
/web/releases/20210916164447/vendor/shopware/storefront/Theme/Command/ThemeCompileCommand.php:63 { …}
/web/releases/20210916164447/vendor/symfony/console/Command/Command.php:255 { …}
/web/releases/20210916164447/vendor/symfony/console/Application.php:1027 { …}
/web/releases/20210916164447/vendor/symfony/framework-bundle/Console/Application.php:97 { …}
/web/releases/20210916164447/vendor/symfony/console/Application.php:273 { …}
/web/releases/20210916164447/vendor/symfony/framework-bundle/Console/Application.php:83 { …}
/web/releases/20210916164447/vendor/symfony/console/Application.php:149 { …}
/web/releases/20210916164447/bin/console:68 {
› $application = new Application($kernel->getKernel());
› $application->run($input);
›
}
}
}
]
The problem happens while compiling a shopware theme and my solution is to change line 91 of the ParserState:
// from
return iconv('utf-32le', $this->sCharset, $sUtf32);
// to
mb_convert_encoding($sUtf32 , $this->sCharset , 'UTF-32LE');
It seems some versions of iconv can't convert UTF32LE to UTF-8, although the PHP and iconv version are the same on both my machines 🤷
Feel free to not accept the PR, for the moment I'll fix it with a composer-patch.
P.S. Thanks for your work! <3