bug49528.phpt 836 B

1234567891011121314151617181920
  1. --TEST--
  2. Bug #49528 (UTF-16 strings prefixed by BOM wrongly converted)
  3. --EXTENSIONS--
  4. mbstring
  5. --FILE--
  6. <?php
  7. var_dump(bin2hex(mb_convert_encoding("\xff\xfe\x01\x02\x03\x04", "UCS-2BE", "UTF-16")));
  8. var_dump(bin2hex(mb_convert_encoding("\xfe\xff\x01\x02\x03\x04", "UCS-2BE", "UTF-16")));
  9. var_dump(bin2hex(mb_convert_encoding("\xff\xfe\xff\xfe\x01\x02\x03\x04", "UCS-2BE", "UTF-16")));
  10. var_dump(bin2hex(mb_convert_encoding("\xff\xfe\xfe\xff\x01\x02\x03\x04", "UCS-2BE", "UTF-16")));
  11. var_dump(bin2hex(mb_convert_encoding("\xfe\xff\xff\xfe\x01\x02\x03\x04", "UCS-2BE", "UTF-16")));
  12. var_dump(bin2hex(mb_convert_encoding("\xfe\xff\xfe\xff\x01\x02\x03\x04", "UCS-2BE", "UTF-16")));
  13. ?>
  14. --EXPECT--
  15. string(8) "02010403"
  16. string(8) "01020304"
  17. string(12) "feff02010403"
  18. string(12) "fffe02010403"
  19. string(12) "fffe01020304"
  20. string(12) "feff01020304"