KEncodingProber vs "unexisting" codecs

Albert Astals Cid aacid at kde.org
Sun May 24 05:18:21 UTC 2015


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.

Not good.

Two ways to fix this that i can think of:
 * Go through all the probers and remove the ones that "don't exist" in Qt
 * On runtime when creating the prober check if Qt understands it before 
testing if the data matches it

The first is defenitely faster on execution time but is also less versatile 
and i don't know enough about QTextCoded internals to be sure all the codecs 
that are available in my ditro are available on distro X and viceversa, so 
maybe option 2 is better.

Opinions and comments before i start implementing?

Cheers,
  Albert


More information about the Kde-frameworks-devel mailing list