summaryrefslogtreecommitdiff
path: root/inc/utf8.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/utf8.php')
-rw-r--r--inc/utf8.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index 4fee844d6..9fc99820e 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -54,6 +54,23 @@ function utf8_isASCII($str){
}
/**
+ * Strips all highbyte chars
+ *
+ * Returns a pure ASCII7 string
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function utf8_strip($str){
+ $ascii = '';
+ for($i=0; $i<strlen($str); $i++){
+ if(ord($str{$i}) <128){
+ $ascii .= $str{$i};
+ }
+ }
+ return $ascii;
+}
+
+/**
* Tries to detect if a string is in Unicode encoding
*
* @author <bmorel@ssi.fr>