Namespaces | Functions

include/inc.utf8checker.php File Reference

Go to the source code of this file.

Namespaces

namespace  ilias
 

admin objects frameset


Functions

 isUTF8 ($aStr)
 seems_not_utf8 ($AStr)
 getUTF8String ($aStr)

Function Documentation

getUTF8String ( aStr  ) 

Definition at line 70 of file inc.utf8checker.php.

References isUTF8().

                              {
        if (!isUTF8($aStr)) {   
                
                return utf8_encode($aStr);
                
        }
        return $aStr;
}

Here is the call graph for this function:

isUTF8 ( aStr  ) 

Definition at line 36 of file inc.utf8checker.php.

Referenced by getUTF8String().

                        {
        $field = "/^(";
        $field .="[\x09|\x0A|\x0D]|[\x20-\x7E]|";
        $field .="[\xC2-\xDF][\x80-\xBF]|";
        $field .="\xE0[\xA0-\xBF][\x80-\xBF]|";
        $field .="[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|";
        $field .="\xED[\x80-\x9F][\x80-\xBF]|";
        $field .="\xF0[\x90-\xBF][\x80-\xBF]{2}|";
        $field .="[\xF1-\xF3][\x80-\xBF]{3}|";
        $field .="\xF4[\x80-\x8F][\x80-\xBF]{2}";
        $field .=")*$/s";
        return preg_match($field, $AStr);
}

Here is the caller graph for this function:

seems_not_utf8 ( AStr  ) 

Definition at line 50 of file inc.utf8checker.php.

Referenced by ilObjSCORMLearningModule::readObject().

{

        $ptrASCII = '[\x00-\x7F]';
        $ptr2Octet = '[\xC2-\xDF][\x80-\xBF]';
        $ptr3Octet = '[\xE0-\xEF][\x80-\xBF]{2}';
        $ptr4Octet = '[\xF0-\xF4][\x80-\xBF]{3}';
        $ptr5Octet = '[\xF8-\xFB][\x80-\xBF]{4}';
        $ptr6Octet = '[\xFC-\xFD][\x80-\xBF]{5}';

        if (preg_match("/^($ptrASCII|$ptr2Octet|$ptr3Octet|$ptr4Octet|$ptr5Octet|$ptr6Octet)*$/s", $AStr))
        {
                return true;
        }
        else
        {
                return false;
        }
}

Here is the caller graph for this function: