Re: UTF-8 string validity detection

From: Date: Tue, 13 May 2003 19:01:06 +0000
Subject: Re: UTF-8 string validity detection
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-567@lists.php.net to get a copy of this message
"Cestmir Hybl" <cestmir@nustep.net> wrote: <snip> > preg_match("/^($ptrASCII|$ptr2Octet|$ptr3Octet|$ptr4Octet|$ptr5Octet|$ptr6Oc > tet)*$/s", $AStr); > } > > but it tends to segfault on longer input (~10kB of text). That sounds like a genuine bug. Could you file a new bug report with a description how it segfaults (in what situation, etc..) at http://bugs.php.net/ ? It's most likely a PCRE's problem.. > I've performed couple of tests and your solution seems to work fine, though > there's no specification on how exactly mb_convert_encoding() behaves on > incorrect input and how this may change in future. Stability of UTF-8 <-> > UCS-4 round trip seems to be guarantied in RFC 2279. If you are in such concern, you might be better off using iconv() function instead of mb_convert_encoding(), as the behaviour of iconv() is cleary defined in the Single Unix Specifications. http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html Moriyoshi

« previous php.i18n (#567) next »