Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iconv(): Wrong charset, conversion from utf-32le to utf-8 is not allowed #341

Open
Schrank opened this issue Sep 22, 2021 · 0 comments · May be fixed by #342
Open

iconv(): Wrong charset, conversion from utf-32le to utf-8 is not allowed #341

Schrank opened this issue Sep 22, 2021 · 0 comments · May be fixed by #342

Comments

@Schrank
Copy link

Schrank commented Sep 22, 2021

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

@Schrank Schrank changed the title iconv(): Wrong charset, conversion from utf-32le' to utf-8' is not allowed iconv(): Wrong charset, conversion from utf-32le to utf-8 is not allowed Sep 22, 2021
@Schrank Schrank linked a pull request Sep 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant