Add stripAccents to KStringHandler
Frederik Gladhorn
frederik.gladhorn at gmx.de
Thu Oct 18 11:34:32 BST 2007
El Thursday 18 October 2007, Thiago Macieira escribió:
> Em Thursday 18 October 2007 04:05:16 Frederik Gladhorn escreveu:
> > I would like to add one function to KStringHandler which will be used to
> > remove accents from QStrings.
> >
> > This includes all sorts of char variations. "Häáàâllo" will become
> > "Haaaallo".
> >
> > At this moment KHangMan has code like this to do the same with a list of
> > accent chars hardcoded. The list is incomplete and not very reliable.
> > Adding support for new languages requires code changes to handle special
> > characters right now. This can be avoided by using the unicode functions.
> > The same applies to Kanagram.
> >
> > Parley uses the attached method to give feedback for accent mistakes.
> >
> > The KStringHandler class seems to be the right place for the function.
> > Since it only adds a function it is binary compatible.
>
> It seems awfully specific for a method in KStringHandler. It's very simple
> to do it using NFD just like you did in your patch.
>
> And I fear that adding a "noAccents" (actually, no combining symbols, which
> have other markers that aren't accents) function will trigger people trying
> to compare "no accent" versions of strings, which is incorrect for some
> locales.
Yes, it is really easy to use, but nobody knows about this. People somehow
tend to not read unicode specifications and it took me a couple of hours to
find out about it because I was not satisfied with creating char mappings.
Of now four programs benefiting from this (add Marble as it seems) no dev knew
about it. And I wonder how many other apps could use this for search fields
and maybe in other places.
Would you feel more comfortable with "stripDiacritics" as name?
Greetings,
Frederik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071018/3f1e1374/attachment.sig>
More information about the kde-core-devel
mailing list