You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
simplexml_load_string in AbstractXmlOutputParser:transformXmlToArray method doesn't work for some files based on the encoding/charset.
Sample error (it says warning but it basically is an error since it makes the code not work at all):
Warning: simplexml_load_string(): Entity: line 54: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xFC 0x73 0x6E 0xFC in /Users/taylankasap/Sites/T/vendor/mhor/php-mediainfo/src/Parser/AbstractXmlOutputParser.php on line 14
Replacing line 14 with one of these makes it work but I'm not sure if this won't break anything else and work for all encodings. Writing tests for different encodings might be a good idea
// This
$xml = simplexml_load_string(str_replace('encoding="UTF-8"', 'encoding="ISO-8859-1"', $xmlString));
// or this
$xml = simplexml_load_string(utf8_encode($xmlString));
Example code & mp3 file that's not working:
$mediaInfo = new \Mhor\MediaInfo\MediaInfo();
$mediaInfoContainer = $mediaInfo->getInfo("track-7f01c33918c6070efca7851b14bb31a3.mp3");
simplexml_load_string
inAbstractXmlOutputParser:transformXmlToArray
method doesn't work for some files based on the encoding/charset.Sample error (it says warning but it basically is an error since it makes the code not work at all):
Replacing line 14 with one of these makes it work but I'm not sure if this won't break anything else and work for all encodings. Writing tests for different encodings might be a good idea
Example code & mp3 file that's not working:
track-7f01c33918c6070efca7851b14bb31a3.mp3.zip
Bytes 0xFC 0x73 0x6E 0xFC in the warning corresponds to the bold part of the artist name: "Erdal Hüsnü Kizilçay"
The text was updated successfully, but these errors were encountered: