Skip to content

iconv(): Wrong charset, conversion from '3' to 'UCS-4LE' is not allowed #177

@mvandeweerd

Description

@mvandeweerd

Hi,

Thank you for this package. We have stumbled upon some cases were we get fatal exceptions due to charset conversion errors. We fetch the RAW email from either the Gmail or Outlook API and pass that to the from() method:

$message = Message::from($rawEmailFromGmail);

Whenever we run $message->getHtmlContent() we sometimes run into conversion errors as seen in the issue subject:

ErrorException: iconv_strlen(): Wrong charset, conversion from3' to UCS-4LE' is not allowed in /var/www/trengoweb/envoyer/releases/20210805205144/vendor/zbateson/mb-wrapper/src/MbWrapper.php:397

It seems that 3 is not supported by iconv, but it is odd that it still tries to convert it. Is this a bug? And is wrapping getHtmlContent() in a try/catch block and retrying it with setCharsetOverride('UTF-8) a proper fix?

Thanks again!

Kind regards,

Marcel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions