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

--- Comment #18 from Bryan Tong Minh <[email protected]> 2011-05-06 
07:30:31 UTC ---
(In reply to comment #15)
> (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).

It's only done on 255 byte strings, so the slow down should be negligible.

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