Por qué
$output = '<hello'; echo mb_convert_encoding( $output, 'UTF-16', 'UTF-8' );muestra
<�helloYo estaba esperando
<hello¿Algunas ideas?
Editar: parece relacionado con el navegador porque funciona en la línea de comandos. Pero sigo sin entender...
$ echo '<hello' | od -x 0000000 683c 6c65 6f6c 000a 0000007 $ php -v PHP 7.3.11 (cli) (built: Jun 5 2020 23:50:40) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies $ cat hoge.php <?php $output = '<hello'; echo mb_convert_encoding( $output, 'UTF-16', 'UTF-8' ); $ php hoge.php | od -x 0000000 3c00 6800 6500 6c00 6c00 6f00 0000014Lo intenté. ¿Está bien?