D29381: Thumbnail text: use libmagic to detect encoding

Méven Car noreply at phabricator.kde.org
Sun May 3 11:24:47 BST 2020


meven created this revision.
meven added reviewers: Frameworks, sitter, ngraham.
Herald added projects: Dolphin, Frameworks.
Herald added subscribers: kfm-devel, kde-frameworks-devel.
meven requested review of this revision.

REVISION SUMMARY
  libmagic is the libraray used in `file` utility to search for file encoding based on heuristics.
  
  `QTextCodec::codecForUtfText` is limited to detecting UTF-8 BOM encoded files.
  If this fails `QTextCodec::codecForLocale` is used to decode all text files, which can be quite incaccurate.
  
  When QTextCodec::codecForUtfText did not find a valid UTF-* file, use libmagic to find a TextCodec.
  It can better confirmm UTF-8 presence.
  latin-1 is used as default 8-bit ascii codex when libmagic cannot find a precise result.
  
  BUG: 316390
  FIXED-IN: 20.08

TEST PLAN
  In doplhin, see preview of different non utf-8 encoded text files.

REPOSITORY
  R320 KIO Extras

BRANCH
  master

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

AFFECTED FILES
  CMakeLists.txt
  cmake/Findlibmagic.cmake
  thumbnail/CMakeLists.txt
  thumbnail/config-thumbnail.h.cmake
  thumbnail/textcreator.cpp

To: meven, #frameworks, sitter, ngraham
Cc: kde-frameworks-devel, kfm-devel, azyx, nikolaik, pberestov, iasensio, aprcela, fprice, LeGast00n, cblack, fbampaloukas, alexde, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, rdieter, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200503/49259708/attachment.html>


More information about the Kde-frameworks-devel mailing list