summaryrefslogtreecommitdiff
path: root/inc/utf8.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/utf8.php')
-rw-r--r--inc/utf8.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index 1d2676688..bd52a7cf2 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -42,6 +42,18 @@ function utf8_decodeFN($file){
}
/**
+ * Checks if a string contains 7bit ASCII only
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function utf8_isASCII($str){
+ for($i=0; $i<strlen($str); $i++){
+ if(ord($str{$i}) >127) return false;
+ }
+ return true;
+}
+
+/**
* Tries to detect if a string is in Unicode encoding
*
* @author <bmorel@ssi.fr>