0

I believe this was caused by this character: %EF%BF%BD, %uFFFD, or other special chars are working fine like %E2%98%86, %u2606, or

What I am doing it dumping mp3 file tag data with getid3 via ajax, I can work around this by removing the property that has this character as i am not using that part, but I would rather have the character not break my script

require_once('/usr/share/php/getid3/getid3.php');
$getID3=new getID3;
die(json_encode((object)array("id3"=>$getID3->analyze($file)['tags']['id3v2'],"other"=>"data"));

From what I have managed to figure out I would guess this character is not a UTF-8 character, so aside from doing something ugly like looping through every property name and property and using mb_convert_encoding on it rebuilding the data is there a reasonable way to do this?

  • `\ufffd` isn't the problem, it's the symptom. It means that wherever that character occurs it has replaced a broken UTF8 sequence in the input data, [but chances are you're just interpreting as the wrong charset](https://en.wikipedia.org/wiki/Mojibake). [ID3v2](https://en.wikipedia.org/wiki/ID3#ID3v2) allows for several different encodings, so you're going to have to detect and translate. – Sammitch Mar 13 '18 at 00:34
  • Related: https://stackoverflow.com/a/25510366/2943403 – mickmackusa Mar 13 '18 at 00:52
  • See edit at end of this answer: https://stackoverflow.com/a/10310227/2943403 – mickmackusa Mar 13 '18 at 00:55

0 Answers0