Bug #81676 [Opn->Dup]: Converting string to UTF using \mb_convert_encoding returns empty string

From: Date: Tue, 30 Nov 2021 12:28:24 +0000
Subject: Bug #81676 [Opn->Dup]: Converting string to UTF using \mb_convert_encoding returns empty string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238057@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81676&edit=1 ID: 81676 Updated by: cmb@php.net Reported by: anton at gamee dot com Summary: Converting string to UTF using \mb_convert_encoding returns empty string -Status: Open +Status: Duplicate Type: Bug -Package: Unknown/Other Function +Package: mbstring related Operating System: MacOs PHP Version: 8.1.0 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Well, encoding detection is generally hard, if not impossible, and there have been changes lately. Basically, your problem boils down to <https://3v4l.org/K2qsM>. Anyhow, this ticket is a duplicate of bug #81390. Previous Comments: ------------------------------------------------------------------------ [2021-11-30 12:10:16] anton at gamee dot com Description: ------------ When using function \mb_convert_encoding() with third parameter \mb_list_encodings() function returns empty string. Test script: --------------- <?php declare(strict_types=1); $string = 'test'; $string = \mb_convert_encoding($string, 'UTF-8', \mb_list_encodings()); echo $string; // '' expecting 'test' Expected result: ---------------- test Actual result: -------------- '' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81676&edit=1

« previous php.bugs (#238057) next »