[kmymoney4] [Bug 371069] CSV plugin mishandles UTF-16 files
allan via KDE Bugzilla
bugzilla_noreply at kde.org
Sat Oct 22 13:06:19 UTC 2016
https://bugs.kde.org/show_bug.cgi?id=371069
--- Comment #9 from allan <agander93 at gmail.com> ---
(In reply to Thomas Baumgart from comment #8)
> I tried this on my KDE4, KMyMoney 4.8 production system (this is generated
> of HEAD on the 4.8 branch).
<snip>
> When I change the encoding in the dialog to UTF-16 before I select the file,
> then things seem to work properly.
Just to be clear, are you saying that you do not then see the problem I
reported, of the data being garbled? If I ensure that UTF-16 is already
selected - displayed in the file selector - then I definitely do see the
corruption.
> I am looking at the following snippet in
> CSVDialog::readFile(const QString& fname):
Might this be a non-current git head version? There has recently been some
reformatting of the source and I have void CSVWizard::readFile(const QString&
fname), as does the current git head. In terms of the actual code, they are
identical in this particular area. Just to be clear, again.
So far as the selector is concerned, then, yes, there are a couple of problems,
although if the decoding is for UTF-16, from previous activity or from setting
it prior to selecting the file, then the file should have the required
encoding. Some tweaking looks to be necessary though.
Allan
>
> 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