KEncodingProber vs "unexisting" codecs

Albert Astals Cid aacid at kde.org
Thu Jul 2 23:18:33 UTC 2015


El Dissabte, 6 de juny de 2015, a les 10:30:52, David Faure va escriure:
> 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.

I just removed it.

> 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.

Question is, where do we want that? Do we want it on probing time so we don't 
try to probe codecs that don't exist (for this installation), or should we 
actually mention in the docs that it may happen that the returned codec does 
not exist and thus you should check the result in the "caller" side?

Cheers,
  Albert


More information about the Kde-frameworks-devel mailing list