Page 1 of 1

Russian language tag wrong coding...

Posted: Mon Jul 24, 2006 6:36 pm
by ksl
Thank you for nice class

Posted: Mon Jul 24, 2006 8:24 pm
by Allan Hansen
If your files are tagged properly, you only ned to set the proper output encoding like this:

Code: Select all

// Initialize getID3 engine
$getid3 = new getID3;

// Tell getID3() to use UTF-8 encoding - must send proper header as well.
$getid3->encoding = 'UTF-8';

// Tell browser telling it use UTF-8 encoding as well.
header('Content-Type: text/html; charset=UTF-8');

If this does not help, then your MP3 files are very likely tagged incorrectly with ID3 tags.

ID3v1 tags must be encoded in ISO-8859-1 according to specification. However several taggers use the system charset instead in order to allow cyrillic and other characters - otherwise it would be impossible.

getID3() can handle this through the encoding_id3v1 option:

Code: Select all

$getid3->encoding_id3v1 = 'YOUR_SYSTEM_CHARSET';

ID3v2 tags must be encoded in ISO-8859-1 or UTF-8 according to specification. However some braindead taggers use the system charset instead and thus breaks specification for no reason.

getID3() can handle this through the encoding_id3v2 option:

Code: Select all

$getid3->encoding_id3v2 = 'YOUR_SYSTEM_CHARSET';

YOUR_SYSTE_CHARTSET is probably CP1251, ISO-8859-5 or KOI8-R for Russia.

Posted: Sun Jan 28, 2007 9:14 am
by mitke
Hi, I have this problem with hebrew characters in the tags.
I've tried using

Code: Select all

$getid3->encoding_id3v1 = 'CP1255'; 
but I get the error message:
PHP does not have iconv() support - cannot convert from CP-1255 to UTF-8
B.T.W - The site is a drupal installation, with PHP 5. iconv is installed.

Posted: Sun Jan 28, 2007 10:12 am
by Allan Hansen
mitke wrote:B.T.W - The site is a drupal installation, with PHP 5. iconv is installed.
Are you absolutely sure that both libiconv is installed and that iconv support has been enabled for PHP?

Try doing a phpinfo(); and look for iconv.

Posted: Sun Jan 28, 2007 11:08 am
by mitke
Hi Allan,

This is what phpinfo() has to say regarding the iconv:
iconv support: enabled
iconv implementation: glibc
iconv library version: 2.3.6

Directive Local Value Master Value
iconv.input_encoding ISO-8859-1 ISO-8859-1
iconv.internal_encoding ISO-8859-1 ISO-8859-1
iconv.output_encoding ISO-8859-1 ISO-8859-1

Posted: Sun Jan 28, 2007 4:12 pm
by Allan Hansen
Please try getID3() 1.7.8b1 if you are not using that version already. I think I fixed a similar problem, but forgot to put it in the changelog.

Posted: Sun Jan 28, 2007 9:22 pm
by mitke
Allan Hansen wrote:Please try getID3() 1.7.8b1 if you are not using that version already. I think I fixed a similar problem, but forgot to put it in the changelog.
OK, the error is gone, but the tags are still not read the way they should.
My settings:

Code: Select all

  $getID3 = new getID3;
  $getID3->encoding         = 'UTF-8';
  $getID3->encoding_id3v1   = 'ISO-8859-1';
  $getID3->encoding_id3v2   = 'UTF-8';
Then I call the analyze function.
At the end of the function I print the info array and get the following:

Code: Select all

array (
  'GETID3_VERSION' => '1.7.8b1',
  'filesize' => 442586,
  'avdataoffset' => 4608,
  'avdataend' => 442458,
  'fileformat' => 'mp3',
  'audio' => 
  array (
    'dataformat' => 'mp3',
    'channels' => 2,
    'sample_rate' => 44100,
    'bitrate' => 128000,
    'channelmode' => 'stereo',
    'bitrate_mode' => 'cbr',
    'lossless' => false,
    'encoder_options' => 'CBR128',
    'compression_ratio' => 0.0907029478458,
    'streams' => 
    array (
      0 => 
      array (
        'dataformat' => 'mp3',
        'channels' => 2,
        'sample_rate' => 44100,
        'bitrate' => 128000,
        'channelmode' => 'stereo',
        'bitrate_mode' => 'cbr',
        'lossless' => false,
        'encoder_options' => 'CBR128',
        'compression_ratio' => 0.0907029478458,
      ),
    ),
  ),
  'tags' => 
  array (
    'id3v1' => 
    array (
      'title' => 
      array (
        0 => '

Posted: Mon Jan 29, 2007 9:03 am
by Allan Hansen
Please send me a sample file and I will take a quick look at it.

ah at artemis dot dk