in reply to Help needed to compare two unicode strings!!!
I'm no expert on Unicode, but I think this is precisely the problem that Unicode::Normalize sets out to solve.
When you say you "want to cover both equivalence(s)", do you mean you want all such equivalences to compare equal? If so, based on a quick read of the slightly opaque documentation, I would guess you want to convert each string into either NFC or NFKC form: it isn't clear to me what the difference between the two is, but they both return a string formed by "compatibility decomposition followed by canonical composition".
If you're not certain, I'd suggest devising some tests that characterise the equivalences you're trying to allow, and run them through something like:
sub ucompare { my($s, $t) = @_; use Unicode::Normalize; print "NFC-equivalent" if NFC($s) eq NFC($t); print "NFKC-equivalent" if NFKC($s) eq NFKC($t); }
Hope this helps,
Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help needed to compare two unicode strings!!!
by pijush (Scribe) on Aug 30, 2004 at 17:02 UTC | |
by pg (Canon) on Aug 31, 2004 at 01:41 UTC | |
by pijush (Scribe) on Aug 31, 2004 at 04:37 UTC |