1--TEST-- 2Bug #65045: mb_convert_encoding breaks well-formed character 3--EXTENSIONS-- 4mbstring 5--FILE-- 6<?php 7 8mb_internal_encoding('UTF-8'); 9 10$str = "\xF0\xA4\xAD". "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"; 11$str2 = "\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD\xA2"."\xF0\xA4\xAD"; 12 13mb_substitute_character(0xFFFD); 14 15echo bin2hex(htmlspecialchars_decode(htmlspecialchars($str, ENT_SUBSTITUTE, 'UTF-8'))), "\n"; 16echo bin2hex(htmlspecialchars_decode(htmlspecialchars($str2, ENT_SUBSTITUTE, 'UTF-8'))), "\n"; 17echo bin2hex(mb_convert_encoding($str, 'UTF-8', 'UTF-8')), "\n"; 18echo bin2hex(mb_convert_encoding($str2, 'UTF-8', 'UTF-8')), "\n"; 19 20?> 21--EXPECT-- 22efbfbdf0a4ada2f0a4ada2 23f0a4ada2f0a4ada2efbfbd 24efbfbdf0a4ada2f0a4ada2 25f0a4ada2f0a4ada2efbfbd 26