KEncodingProber vs "unexisting" codecs

David Faure faure at kde.org
Sat Jun 6 08:30:52 UTC 2015


On Sunday 24 May 2015 07:18:21 Albert Astals Cid wrote:
> One of the codecs that KEncodingProber can return is x-euc-tw
> 
> But neither the Qt4 nor the Qt5 installed in my distribution understand that
> codec, so doing the suggested
> 
>   QTextCodec::codecForName(prober.encoding())->toUnicode(data);
> 
> Will crash.

Qt's ICU codec indeed doesn't support euc-tw, because it's not even registered 
at IANA:
http://www.iana.org/assignments/character-sets/character-sets.xhtml
(and that's what qicucodec.cpp uses as the base list)

I would just remove it from the prober.

You are right, however, that a runtime check is needed anyway, because one can 
compile Qt without ICU support, and then the list of supported codecs might be 
different.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list