iconv_fallback example

$frame_textencoding_terminator = "\x00";
            }
            $frame_terminatorpos = strpos($parsedFrame['data']$frame_textencoding_terminator$frame_offset);
            if (ord(substr($parsedFrame['data']$frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) {
                $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00             }
            $parsedFrame['description'] = substr($parsedFrame['data']$frame_offset$frame_terminatorpos - $frame_offset);
            $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']);
            $parsedFrame['encodingid']  = $frame_textencoding;
            $parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);

            $parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding']$info['id3v2']['encoding']$parsedFrame['description']));
            $parsedFrame['data'] = substr($parsedFrame['data']$frame_terminatorpos + strlen($frame_textencoding_terminator));
            $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data']$frame_textencoding_terminator);
            if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
                $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
                if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey$info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
                    $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding']$info['id3v2']['encoding']$parsedFrame['data']));
                } else {
                    $info['id3v2']['comments'][$parsedFrame['framenameshort']][]            = trim(getid3_lib::iconv_fallback($parsedFrame['encoding']$info['id3v2']['encoding']$parsedFrame['data']));
                }
            }
            //unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain
// loop thru array         foreach ($array as $key => $value) {

            // go recursive             if (is_array($value)) {
                $this->CharConvert($array[$key]$encoding);
            }

            // convert string             elseif (is_string($value)) {
                $array[$key] = trim(getid3_lib::iconv_fallback($encoding$this->encoding, $value));
            }
        }
    }

    /** * @return bool */
    public function HandleAllTags() {

        // key name => array (tag name, character encoding)         static $tags;
        

                                    }
                                }

                            } elseif (!is_array($value)) {

                                $newvaluelength   =    strlen(trim($value));
                                $newvaluelengthMB = mb_strlen(trim($value));
                                foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
                                    $oldvaluelength   =    strlen(trim($existingvalue));
                                    $oldvaluelengthMB = mb_strlen(trim($existingvalue));
                                    if (($newvaluelengthMB == $oldvaluelengthMB) && ($existingvalue == getid3_lib::iconv_fallback('UTF-8', 'ASCII', $value))) {
                                        // https://github.com/JamesHeinrich/getID3/issues/338                                         // check for tags containing extended characters that may have been forced into limited-character storage (e.g. UTF8 values into ASCII)                                         // which will usually display unrepresentable characters as "?"                                         $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
                                        break;
                                    }
                                    if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
                                        $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
                                        break;
                                    }
                                }

                            }
0x0B => 'Composer',
                0x0C => 'Lyricist',
                0x0D => 'Recording Location',
                0x0E => 'During Recording',
                0x0F => 'During Performance',
                0x10 => 'Video Screen Capture',
                0x12 => 'Illustration',
                0x13 => 'Band Logotype',
                0x14 => 'Publisher Logotype'
            );
            $lookup = array_map(function($str) {
                return getid3_lib::iconv_fallback('UTF-8', 'UTF-16LE', $str);
            }$lookup);
        }

        return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : '');
    }

    /** * @param string $asf_header_extension_object_data * @param int $unhandled_sections * * @return array */
Home | Imprint | This part of the site doesn't use cookies.