[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: russian texts
From: Joerg Anders <j.anders () informatik ! tu-chemnitz ! de>
Date: 2003-06-30 13:37:33
[Download RAW message or body]
Hi all!
I hope there are some Russian developers on this list.
(I guess the same problems would occur with Hebrew
texts.)
The problem is: Russian users can input Cyrillic
lyrics in my musical score editor NoteEdit:
http://rnvs.informatik.tu-chemnitz.de/~jan/noteedit/noteedit.html
They also see the Cyrillic text on Q(x)Widget. But if I write
the lyrics to some file and try to restore them the text
is destroyed.
Unfortunately I have no Cyrillic keyboard and thus, I can't
input Cyrillic lyrics. But I made test with German Umlauts
(HTML: ä ö ü ...; ß).
I wrote a simple test class "UTFText" which works so far.
Perhaps some Russian devopers (and/or others (???)) could please
have a look at my intentions. Or perhaps there is a instruction
page to avoid problems with non-ascii-glyphs:
The class is:
class UTFText : public QDialog {
Q_OBJECT
public:
UTFText(QWidget *parent = 0);
protected:
virtual void resizeEvent ( QResizeEvent * evt);
private:
QPushButton *writeText_;
QPushButton *readText_;
QTextEdit *ifeld_;
private slots:
void readInternationalText();
void writeInternationalText();
};
Important are only the implementations of the 2 slots which
shall write/read the text in "ifeld_" as UFT8
(or should I use Unicode ???) to some file:
#define TEXTFILE "/tmp/xxx.txt"
void UTFText::writeInternationalText() {
ofstream out;
out.open(TEXTFILE);
if (!out) { /* error */ }
out << ifeld_->text().utf8() << endl;
out.close();
}
void UTFText::readInternationalText() {
char buffer[1000];
QString s;
ifstream in;
in.open (TEXTFILE);
if (!in) { /* error */ }
in.getline(buffer, 1000);
s = QString::fromUtf8(buffer);
ifeld_->setText(s);
}
--
J.Anders, Chemnitz, GERMANY (ja@informatik.tu-chemnitz.de)
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic