https://bugzilla.wikimedia.org/show_bug.cgi?id=27849

--- Comment #15 from Brion Vibber <[email protected]> 2011-05-05 22:35:30 UTC 
---
(In reply to comment #14)
> Can't you do something like
> $string2 = $string
> UtfNormal::quickIsNFCVerify( $string2 );
> $stringIsValidUTF8 = $string === $string2 ? true : false;
> 
> As far as I can tell, the quickIsNFCVerify doesn't seem to do anything with 
> the
> string argument other then remove invalid sequences, and remove control
> characters (or replace with the replacement character).

Hmmmmm, you know what, that should work just fine actually. :)

Downside: may be slower than UtfNormal::cleanUp() on some input texts on some
systems, eg if NORMALIZE_ICU is on and using that extension. In other modes,
that same code is already getting run if we're calling UtfNormal::cleanUp(), so
it should be about the same speed for common cases if we're using either the
default or the NORMALIZE_INTL mode (since it calls quickIsNFCVerify anyway to
validate UTF-8 before doing the normalization call).

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to