cstring returning invalid encoding? mp3's

Caleb Cushing xenoterracide at gmail.com
Mon Sep 21 22:00:24 CEST 2009


made a more simple prorgram... to test with

#include <iostream>
#include <cstring>
#include <cstdio>
#include <fileref.h>
#include <tag.h>
#include <tstring.h>
using namespace std;
int main()
{
    TagLib::FileRef tfile("/home/music/R/Rihanna/Music_of_the_Sun/12-Now_I_Know-
    cout << tfile.tag()->title() << endl;

    const char *ttitle = tfile.tag()->title().toCString(true);

    while(*ttitle) {
        cout << hex << static_cast<int> (*ttitle++) << " ";
    }
    cout << endl;
}

compiled with
g++ -I /usr/include/taglib -l tag tags.cpp -o tagger

several runs. same file... wtf?

slave4 src $ ./tagger
Now I Know
ffffffb0 61 ffffffa9 1
slave4 src $ ./tagger
Now I Know
ffffffb0 ffffff81 52 2
slave4 src $ ./tagger
Now I Know
ffffffb0 11 6e 1
slave4 src $ ./tagger
Now I Know
ffffffb0 41 fffffff5



change the program to use a flac instead of an mp3...

slave4 src $ ./tagger
Working Man
57 6f 72 6b 69 6e 67 20 4d 61 6e
slave4 src $ ./tagger
Working Man
57 6f 72 6b 69 6e 67 20 4d 61 6e
slave4 src $ ./tagger
Working Man
57 6f 72 6b 69 6e 67 20 4d 61 6e

and it works perfectly. I take it back when I said I think it's my
code... I think there's a bug in taglib here somewhere... possibly
(probably) the conversion... I'm not sure. Nore am I sure why amarok
works fine... can anyone suggest a workaround?
-- 
Caleb Cushing

http://xenoterracide.blogspot.com


More information about the taglib-devel mailing list