[3009] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [PATCH] Normalize class names to NFKC when logging

daemon@ATHENA.MIT.EDU (Jeffrey Hutzelman)
Thu Mar 24 11:40:18 2011

From: Jeffrey Hutzelman <jhutz@cmu.edu>
To: Anders Kaseorg <andersk@mit.edu>
Cc: jhutz@cmu.edu, David Benjamin <davidben@mit.edu>, barnowl-dev@mit.edu
In-Reply-To: <alpine.DEB.2.02.1103240316290.4468@dr-wily.mit.edu>
Date: Thu, 24 Mar 2011 11:40:22 -0400

On Thu, 2011-03-24 at 03:36 -0400, Anders Kaseorg wrote:
> On Tue, 14 Dec 2010, David Benjamin wrote:
> > +      /* Class names are normalized to NFKC */
> > +      from = frombuff = g_utf8_normalize(owl_message_get_class(m), -1, G_NORMALIZE_NFKC);
> > …
> >        char* temp = g_utf8_strdown(frombuff, -1);
> 
> The Zephyr server does case folding rather than downcasing (so, for 
> example, ß goes to ss).

Which is appropriate for comparison.


> Furthermore, it does so before normalization 
> rather than after (which maybe makes a difference in crazy corner cases?  
> I don’t really know).

Yes, it makes a difference; case folding does not preserve canonical
form and so must be done first.  The Unicode documents seem to imply
that one might actually want to normalize to NFD, then case-fold, then
do the final normalization.  Further, the situation is apparently more
complicated when the final form is one of the compatibility forms, as
apparently there are some strings for which NFKC(toCaseFold(NFD(x)))
applied repeatedly produces changing results.

I'd also note that the current version of the Unicode standard seems to
define a case-fold-and-NFKC operation intended to be useful for
comparisons such as those done on class names.


On the gripping hand, it seems that in cases where barnowl needs to
convert class names to canonical form, it should do so in exactly the
same way as zephyr.

-- Jeff


home help back first fref pref prev next nref lref last post