Fix a defect in unicode handling

git-svn-id: http://php-reader.googlecode.com/svn/trunk@144 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2009-03-25 20:02:05 +00:00
parent aeadea825d
commit 618d083fad
12 changed files with 75 additions and 144 deletions

View File

@@ -95,18 +95,16 @@ final class ID3_Frame_GEOB extends ID3_Frame
case self::UTF16:
list ($this->_filename, $this->_description, $this->_objectData) =
$this->_explodeString16($this->_data, 3);
$this->_filename = $this->_convertString
(Transform::fromString16($this->_filename), "utf-16");
$this->_filename = $this->_convertString($this->_filename, "utf-16");
$this->_description = $this->_convertString
(Transform::fromString16($this->_description), "utf-16");
($this->_description, "utf-16");
break;
case self::UTF16BE:
list ($this->_filename, $this->_description, $this->_objectData) =
$this->_explodeString16($this->_data, 3);
$this->_filename = $this->_convertString
(Transform::fromString16BE($this->_filename), "utf-16be");
$this->_filename = $this->_convertString($this->_filename, "utf-16be");
$this->_description = $this->_convertString
(Transform::fromString16BE($this->_description), "utf-16be");
($this->_description, "utf-16be");
break;
case self::UTF8:
list ($this->_filename, $this->_description, $this->_objectData) =
@@ -234,16 +232,13 @@ final class ID3_Frame_GEOB extends ID3_Frame
{
$data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0";
switch ($this->_encoding) {
case self::UTF16:
case self::UTF16LE:
$order = $this->_encoding == self::UTF16 ?
Transform::MACHINE_ENDIAN_ORDER : Transform::LITTLE_ENDIAN_ORDER;
$data .= Transform::toString16($this->_filename, $order) . "\0\0" .
Transform::toString16($this->_description, $order) . "\0\0";
$data .= 0xfeff . $this->_filename . "\0\0" . 0xfeff .
$this->_description . "\0\0";
break;
case self::UTF16:
case self::UTF16BE:
$data .= Transform::toString16BE
($this->_filename . "\0\0" . $this->_description . "\0\0");
$data .= $this->_filename . "\0\0" . $this->_description . "\0\0";
break;
default:
$data .= $this->_filename . "\0" . $this->_description . "\0";