import text string from ove files

• Apr 28, 2010 - 09:20

Text strings in ove files are stored in ANCI char string, when I import them, I use:
/////////////////////////////////////////////////////////////////////
// for example, lyrics
Lyrics* lyric = new Lyrics(score_);
lyric->setNo(lyricPtr->getVerse());
lyric->setTick(tick);
std::string l = lyricPtr->getLyric();
lyric->setText(QString::fromLocal8Bit(l.c_str()));
/////////////////////////////////////////////////////////////////////
it works fine on windows, but on linux, it's not, text string are disappear or become weird char.

test file: \test\testoves\bdat\lyric.ove
it has title, composer, lyric which are chinese string.

Anyone know how to solve this?


Comments

You need to know the actual coding of the ascii string. FromLocaliBit() assumes the local system coding (which on linux is mostly utf8) which may be different from actual coding. If you know the coding you must use a specific conversion using something like "fromUtf8()".

In reply to by [DELETED] 3

this function can work:

QString toQString(const std::string& str) {
QTextCodec* codec = QTextCodec::codecForName("GBK");
return codec->toUnicode(str.c_str());
}

But I still don't know how to get the actual coding of the ascii string in ove files, also in midi files too.
My system is Vista English 32bit, and I set "Current locale in non-Unicode programs" = "Chinese (Simplified PRC)" in control panel, or else my Overture can't show chinese string too.

In reply to by [DELETED] 5

ove files are always save with Overture, and no charset info exist. Maybe some midi creator follows SMF Language and Display Extensions , but obviously ove not.

After several days, I find it's similar to the mp3 Tag issue, ID3 Tag are edited on windows(for multibyte asian language), and when on linux or mac itunes, shown as unreadable code.
Some article mentioned EasyTag has a setting to let user choose among some encodings from a dropdown menu.
check "charset when read ID3 tag"(Non-standart) in setting dialog of EasyTag.

Do you still have an unanswered question? Please log in first to post your question.