1

I have my application on a debian platform, which has been decoding these emails since March, which have not had any errors until today.

Attached is a screenshot of the email.

Captural of the email in command

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Bienvenido a Proyecto Test</title>
</head>
</head>

<body>

    <p>Proyecto: Proyecto Test</p>
    <p>Nombre: Tamara COFRÃ </p>
    <p>Email: xxxxxxxx@gmail.com </p>
    <p>Rut: xxxxxxx-x</p>
    <p>Teléfono: 123456789</p>
    <p>Modelo: Londres </p>
    <p>¿Tienes crédito pre-aprobado?: No </p>
    <p>¿Cuándo tienes pensado comprar?: Aún no lo tengo definido </p>
    <p>¿Vivirás en esta propiedad o la arrendarás?: Vivir </p>
    <p>¿Quieres solicitar?: Video llamada </p>

</body>

</html>

Method to extract information

$text = Html2txt::convert_html_to_text($html);
$html = iconv('UTF-8','ISO-8859-1',$text); // ERROR

Message error

   ErrorException

  iconv(): Detected an illegal character in input string

  at C:\sites\laraveñ\app\Quote.php:827
    823|             case 'xxxx@xxxx.cl':
    824|                 Log::channel('mailParse')->info("Proceso de parseo: Web Proyecto \n");
    825|
    826|                 $text = Html2txt::convert_html_to_text($html);
  > 827|                 $html = iconv('UTF-8','ISO-8859-1',$text);
    828|
    829|                 preg_match('/Proyecto: (.*)/',$html,$proyecto);
    830|                 preg_match('/Nombre: (.*)/',$html,$name);
    831|                 preg_match('/Email: (.*)/',$html,$email);

  1   C:\sites\laravel\app\Quote.php:827
      iconv("UTF-8", "ISO-8859-1", "Proyecto: Proyecto Test
alex spencer
  • 177
  • 1
  • 12
  • I think that html should be well formatted for iconv function. At many times you can't convert whole html using iconv but if you can please try this: iconv -t UTF-8 YourFile.txt – EHF Shahab Jul 19 '22 at 15:46
  • @MartinAmu One question did you mean iconv('-t','utf-8',$file.text) or not? anyway I got the following error iconv -t UTF-8 iconv(): Wrong charset, conversion from `-t' to `UTF-8' is not allowediconv(): – alex spencer Jul 19 '22 at 15:54
  • https://stackoverflow.com/questions/374425/convert-utf8-characters-to-iso-88591-and-back-in-php – EHF Shahab Jul 19 '22 at 16:03

0 Answers0