Fix encoding and one byte field issue
git-svn-id: http://php-reader.googlecode.com/svn/trunk@12 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -73,25 +73,31 @@ final class ID3_Frame_GEOB extends ID3_Frame
|
||||
{
|
||||
parent::__construct($reader);
|
||||
|
||||
$this->_encoding = substr($this->_data, 0, 1);
|
||||
$this->_encoding = ord($this->_data{0});
|
||||
$this->_mimeType = substr
|
||||
($this->_data, 1, ($pos = strpos($this->_data, "\0", 1)) - 1);
|
||||
$this->_data = substr($this->_data, $pos);
|
||||
|
||||
switch ($this->_encoding) {
|
||||
case self::UTF16:
|
||||
list ($this->_filename, $this->_description, $this->_data) =
|
||||
preg_split("/\\x00\\x00/", substr($this->_data, $pos), 3);
|
||||
$this->_filename = Transform::getString16LE($this->_filename);
|
||||
$this->_description = Transform::getString16LE($this->_description);
|
||||
break;
|
||||
$bom = substr($this->_data, 0, 2);
|
||||
$this->_data = substr($this->_data, 2);
|
||||
if ($bom == 0xfffe) {
|
||||
list ($this->_filename, $this->_description, $this->_data) =
|
||||
preg_split("/\\x00\\x00/", $this->_data, 3);
|
||||
$this->_filename = Transform::getString16LE($this->_filename);
|
||||
$this->_description = Transform::getString16LE($this->_description);
|
||||
break;
|
||||
}
|
||||
case self::UTF16BE:
|
||||
list ($this->_filename, $this->_description, $this->_data) =
|
||||
preg_split("/\\x00\\x00/", substr($this->_data, $pos), 3);
|
||||
preg_split("/\\x00\\x00/", $this->_data, 3);
|
||||
$this->_filename = Transform::getString16BE($this->_filename);
|
||||
$this->_description = Transform::getString16BE($this->_description);
|
||||
break;
|
||||
default:
|
||||
list ($this->_filename, $this->_description, $this->_data) =
|
||||
preg_split("/\\x00/", substr($this->_data, $pos), 3);
|
||||
preg_split("/\\x00/", $this->_data, 3);
|
||||
$this->_filename = Transform::getString8($this->_filename);
|
||||
$this->_description = Transform::getString8($this->_description);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user