Revision 758
Added by thorn over 17 years ago
| functions-utf8.php | ||
|---|---|---|
| 63 | 63 |
/* |
| 64 | 64 |
* Checks if a string contains 7bit ASCII only |
| 65 | 65 |
* |
| 66 |
* @author Andreas Gohr <andi@splitbrain.org>
|
|
| 66 |
* @author thorn
|
|
| 67 | 67 |
*/ |
| 68 | 68 |
function utf8_isASCII($str){
|
| 69 |
for($i=0; $i<strlen($str); $i++){
|
|
| 70 |
if(ord($str{$i}) >127) return false;
|
|
| 71 |
}
|
|
| 72 |
return true;
|
|
| 69 |
if(preg_match('/[\x80-\xFF]/', $str))
|
|
| 70 |
return false;
|
|
| 71 |
else
|
|
| 72 |
return true;
|
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
/* |
| ... | ... | |
| 1097 | 1097 |
return($string); |
| 1098 | 1098 |
} |
| 1099 | 1099 |
|
| 1100 |
?> |
|
| 1100 |
?> |
|
Also available in: Unified diff
fixed another issue with utf8_isASCII() (too slow with many ~100KB pages)