Version: (using KDE 4.1.1) Installed from: Ubuntu Packages When exporting vcards it would be nice if there were an option to write Windows newlines (\r\n) instead of Linux newlines (\n). This would save a step (newline conversion) for the all-too-common task of moving data between systems.
Hej, KAddressBook in KDE 3.5 and KDE 4.X always export vCards with \r\n as it is requested by the vCard standard.
Created attachment 27882 [details] Vcard file from Kaddressbook 3.5.10 I am leaving this INVALID on the assumption that you are correct, but this is what Kaddressbook 3.5.10 on KDE 3 gave me. KDE 4.x gave something similar. To me it looks like \n, can you confirm that it is in fact \n\r?
I see the problem now: there are two types of newlines in these vcard files: 1) The newlines for the linewrapping, which are in fact /n/r as the spec specifies 2) The newlines for the content (where the user enters a newline in Kaddressbook fields). These are _not_ /n/r which can clearly be seen by opening the attached file from the previous comment in a text editor, or better yet, by importing them in any Windows-based vcard-compliant system. Reopening.
Hej, ahh ok, that explains it ;) However I have no influence on it, KAddressBook just calls QTextEdit::toPlainText(), which returns line ends as '\n' and I won't implement any magic to replace it, as there are several cases where that goes wrong... so no wish list that might create new bugs, sorry.
Created attachment 27917 [details] Vcard file from Kaddressbook 3.5.10 That is pretty bad, as Kontact is not Vcard compliant. Could you file a Qt bug, then? I would file it but I am not as knowledgeable in the field. Attached is a test vcard file. This file has this Notes Field in Kaddressbook: ----- First Line. The Second Line is long so that it will wrap. Long, long, and wrapping! Third Line. ----- This is how it appears when imported directly into a WM2003SE device: ----- First Line.nThe Second Line i s long so that it will wrap. Long, long, and wrapping!nThird Line.n ----- You can see two errors there: 1) The \n characters are shown instead of giving a new line. 2) There is a space in the word "is" where the line wrapped. These two conditions wreck havoc on quoted-printable text, rendering them terribly corrupted. This is a serious bug that leads to data corruption for quoted-printable text.
Tobias, could you file a bug at Trolltech regarding the issue? I really need vCard export capability.
This is not a bug with Qt. When toPlainText() is called eventually the following method is called: QString QTextDocument::toPlainText() const { Q_D(const QTextDocument); QString txt = d->plainText(); txt.replace(QTextBeginningOfFrame, QLatin1Char('\n')); txt.replace(QTextEndOfFrame, QLatin1Char('\n')); txt.replace(QChar::ParagraphSeparator, QLatin1Char('\n')); txt.replace(QChar::LineSeparator, QLatin1Char('\n')); txt.replace(QChar::Nbsp, QLatin1Char(' ')); return txt; } Just call the appropriate QString::replace(...) commands on the QString returned by QTextEdit::toPlainText(). It's not something that's going to get changed in Qt.
In light of Andy's discovery, I am reopening the bug. Thanks!
Since Andy found the problem, can this be fixed?
The development of the old KAddressBook will be discontinued for KDE 4.4. Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.