| 5320 | | $text =~ m/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf])*(.*)/; |
| 5321 | | |
| 5322 | | return 1 unless $2; |
| 5323 | | return 0; |
| | 5320 | if (LJ::are_hooks("is_utf8")) { |
| | 5321 | my @r = LJ::run_hooks("is_utf8", $text); |
| | 5322 | return 0 if grep { ! $_->[0] } @r; |
| | 5323 | return 1; |
| | 5324 | } |
| | 5325 | else { |
| | 5326 | $text =~ m/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf])*(.*)/; |
| | 5327 | |
| | 5328 | return 1 unless $2; |
| | 5329 | return 0; |
| | 5330 | } |