Review Request: remove KEncodingDetector from tier1/kcodecs

David Faure faure at kde.org
Sun Jul 1 10:14:49 BST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105392/#review15285
-----------------------------------------------------------


Great work!

I noticed a few things though:

* in your initial analysis, you said KEncodingDetector had code to detect the encoding from the html/xml and http headers. Is this functionality lost during this port, in khtml?

* you deleted the KEncodingDetector unittest, but apparently KEncodingProber has no unittests. Could you port the old unittest to KEncodingProber, in order to at least validate it a bit, and ideally could you extend the unittest for things that only the prober can do?

* rather than deleting KEncodingDetector, please move it to kde4support (in a separate commit, possibly), so that source compatibility is preserved (just in case there is some application out there that uses it).

- David Faure


On June 30, 2012, 11:01 a.m., Hui Ni wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/105392/
> -----------------------------------------------------------
> 
> (Updated June 30, 2012, 11:01 a.m.)
> 
> 
> Review request for kdelibs, Kevin Ottens and David Faure.
> 
> 
> Description
> -------
> 
> hi, this is my first contribution to kde frameworks.
> This patch removes KEncodingDetector class from tier1/kcodecs and ports all related bits in kdelibs to KEncodingProber class.
> 
> proposal raised at http://mail.kde.org/pipermail/kde-frameworks-devel/2012-June/000738.html
> 
> KEncodingDetector is actually KEncodingProber + encoding priority list + QTextDecoder, and the later two things are used only in khtml.
> 
> things removed:
> enum KEncodingDetector::EncodingChoiceSource -> removed
> KEncodingDetector::setEncoding -> removed, implement it in khtml code
> KEncodingDetector::encodingChoiceSource -> removed
> KEncodingProber::encodingName -> removed, avoid potential memory leak
> 
> one to one changes:
> enum KEncodingDetector::AutoDetectScript -> enum KEncodingProber::ProberType
> KEncodingDetector::encoding -> KEncodingProber::encoding
> KEncodingDetector::visuallyOrdered -> check KEncodingProber::encoding is hebrew or not
> KEncodingDetector::autoDetectLanguage -> KEncodingProber::proberType
> KEncodingDetector::setAutoDetectLanguage -> KEncodingProber::setProberType
> KEncodingDetector::decode -> KEncodingProber::feed + QTextCodec::codecForName(prober.encoding())->toUnicode
> KEncodingDetector::decodeWithBuffering -> KEncodingProber::feed, feed, feed + check KEncodingProber::state + QTextCodec::codecForName(prober.encoding())->makeDecoder
> KEncodingDetector::decodedInvalidCharacters -> QTextCodec::codecForName(prober.encoding())->makeDecoder + hasFailure
> KEncodingDetector::resetDecoder -> KEncodingProber::reset
> KEncodingDetector::flush -> KEncodingProber::feed, feed, feed + QTextCodec::codecForName(prober.encoding())->toUnicode
> KEncodingDetector::scriptForName -> KEncodingProber::proberTypeForName
> KEncodingDetector::nameForScript -> KEncodingProber::nameForProberType
> KEncodingDetector::hasAutoDetectionForScript -> if (proberType == KEncodingProber::None) ... else ...
> 
> 
> Diffs
> -----
> 
>   kdeui/actions/kcodecaction.h 627d770 
>   kdeui/actions/kcodecaction.cpp 97a8a90 
>   khtml/ecma/xmlhttprequest.h 7eb2012 
>   khtml/ecma/xmlhttprequest.cpp 11bcc46 
>   khtml/khtml_part.h 340ece1 
>   khtml/khtml_part.cpp d9d1250 
>   khtml/khtmlpart_p.h d46d254 
>   khtml/test_regression.cpp 8b2fa15 
>   khtml/xml/dom_docimpl.h 71bc13f 
>   khtml/xml/dom_docimpl.cpp 5e34d18 
>   khtml/xml/xml_tokenizer.cpp f65be63 
>   tier1/kcodecs/autotests/CMakeLists.txt 9ce6f85 
>   tier1/kcodecs/autotests/kencodingdetectortest.h a9eedec 
>   tier1/kcodecs/autotests/kencodingdetectortest.cpp d54fcef 
>   tier1/kcodecs/src/CMakeLists.txt e58c438 
>   tier1/kcodecs/src/guess_ja.cpp 0631815 
>   tier1/kcodecs/src/guess_ja_p.h e34d986 
>   tier1/kcodecs/src/kencodingdetector.h e6a0444 
>   tier1/kcodecs/src/kencodingdetector.cpp 1d64bdd 
>   tier1/kcodecs/src/kencodingprober.h da4b958 
>   tier1/kcodecs/src/kencodingprober.cpp 42beac0 
>   tier1/kcoreaddons/src/text/kstringhandler.h b9b6c2e 
> 
> Diff: http://git.reviewboard.kde.org/r/105392/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Hui Ni
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120701/259f0ba3/attachment.htm>


More information about the kde-core-devel mailing list