[kmymoney4] [Bug 371069] CSV plugin mishandles UTF-16 files
Thomas Baumgart via KDE Bugzilla
bugzilla_noreply at kde.org
Sat Oct 22 10:57:22 UTC 2016
https://bugs.kde.org/show_bug.cgi?id=371069
--- Comment #8 from Thomas Baumgart <tbaumgart at kde.org> ---
I tried this on my KDE4, KMyMoney 4.8 production system (this is generated of
HEAD on the 4.8 branch).
What is annoying, that once I select a file it automatically goes off. No way
to change parameters. One should be able to start the process the pressing the
OK button. This causes the UTF-16 data to display weird data due to the 0's
contained.
When I change the encoding in the dialog to UTF-16 before I select the file,
then things seem to work properly. I am looking at the following snippet in
CSVDialog::readFile(const QString& fname):
QFile m_inFile(m_inFileName);
m_inFile.open(QIODevice::ReadOnly); // allow a Carriage return - //
QIODevice::Text
QTextStream inStream(&m_inFile);
QTextCodec* codec =
QTextCodec::codecForMib(m_codecs.value(m_encodeIndex)->mibEnum());
inStream.setCodec(codec);
QString buf = inStream.readAll();
When selecting UTF-16 before selecting your file, QString buf contained the
correct data. I verified this in the debugger and also data displayed in spread
sheet form seemd to be correct.
Hope that helps for further investigation.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the KMyMoney-devel
mailing list