D3203: icalformat: remove QByteArray->QString->QByteArray roundtrip.

Daniel Vrátil noreply at phabricator.kde.org
Sun Nov 26 12:17:28 GMT 2017


dvratil added a comment.


  UTF-8 encoded text can only be present in iCal property values and not property names (otherwise it's not a valid iCal file and that's up to libical to deal with without crashing). libical itself does not attempt to parse unstructured property values (like Summary or Description), it just returns the string to the caller as a `char*`. What KCalCore does is it calls `QString::fromUtf8()` on this `char*`, which internally calls `QUtf8::convertToUnicode()`. `QTextStream`, when used with the "UTF8" codec (i.e. `QUtf8Codec`), internally uses the same method (`QUtf8::convertToUnicode()`) to convert the text.
  
  Therefore I don't think there's any benefit in running the entire iCal string through `QUtf8::convertToUnicode()` if we then do it for each of the property values again when converting them to `QString`. So +1 to David's patch, just re-add the `trimmed()` call please.

REPOSITORY
  R172 KCalendar Core

REVISION DETAIL
  https://phabricator.kde.org/D3203

To: dfaure, djarvie, smartins, mwolff, dvratil
Cc: knauss, kde-pim, #kde_pim, dvasin, winterz, vkrause, mlaurent, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20171126/72b2bc94/attachment.html>


More information about the kde-pim mailing list