framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
public static function convertToFilesystemEncoding($fileName)
    {
        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        $encoding = $_config->getFilesystemEncoding();
        if (is_null($encoding) || strcasecmp($encoding, "UTF-8") == 0 || strcasecmp($encoding, "UTF8") == 0) {
            return $fileName;
        }

        if (!function_exists("iconv")) {
            if (strcasecmp($encoding, "ISO-8859-1") == 0 || strcasecmp($encoding, "ISO8859-1") == 0 || strcasecmp($encoding, "Latin1") == 0) {
                return str_replace("\0", "_", utf8_decode($fileName));
            } else if (function_exists('mb_convert_encoding')) {
                /**
                 * @todo check whether charset is supported - mb_list_encodings
                 */
                $encoded = @mb_convert_encoding($fileName, $encoding, 'UTF-8');
                if (@mb_strlen($fileName, "UTF-8") != @mb_strlen($encoded, $encoding)) {
                    return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName));
                }
                else {
                    return str_replace("\0", "_", $encoded);
                }
            } else {
                return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName));
            }
        }

        $converted = @iconv("UTF-8", $encoding . "//IGNORE//TRANSLIT", $fileName);
        if ($converted === false) {
            return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName));
        }

        return $converted;
    }
public static function convertToFilesystemEncoding($fileName)
    {
        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        $encoding = $_config->getFilesystemEncoding();
        if (is_null($encoding) || strcasecmp($encoding, "UTF-8") == 0 || strcasecmp($encoding, "UTF8") == 0) {
            return $fileName;
        }

        if (!function_exists("iconv")) {
            if (strcasecmp($encoding, "ISO-8859-1") == 0 || strcasecmp($encoding, "ISO8859-1") == 0 || strcasecmp($encoding, "Latin1") == 0) {
                return str_replace("\0", "_", utf8_decode($fileName));
            } else if (function_exists('mb_convert_encoding')) {
                /**
                 * @todo check whether charset is supported - mb_list_encodings
                 */
                $encoded = @mb_convert_encoding($fileName, $encoding, 'UTF-8');
                if (@mb_strlen($fileName, "UTF-8") != @mb_strlen($encoded, $encoding)) {
                    return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName));
                }
                else {
                    return str_replace("\0", "_", $encoded);
                }
            } else {
                return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName));
            }
        }

        $converted = @iconv("UTF-8", $encoding . "//IGNORE//TRANSLIT", $fileName);
        if ($converted === false) {
            return str_replace("\0", "_", preg_replace("/[^[:ascii:]]/u","_",$fileName));
        }

        return $converted;
    }
public static function convertToFilesystemEncoding ( $ fileName ) { $ _config = & CKFinder_Connector_Core_Factory :: getInstance ( "Core_Config" ) ; $ encoding = $ _config -> getFilesystemEncoding ( ) ; if ( is_null ( $ encoding ) || strcasecmp ( $ encoding , "UTF-8" ) == 0 || strcasecmp ( $ encoding , "UTF8" ) == 0 ) { return $ fileName ; } if ( ! function_exists ( "iconv" ) ) { if ( strcasecmp ( $ encoding , "ISO-8859-1" ) == 0 || strcasecmp ( $ encoding , "ISO8859-1" ) == 0 || strcasecmp ( $ encoding , "Latin1" ) == 0 ) { return str_replace ( "\0" , "_" , utf8_decode ( $ fileName ) ) ; } else if ( function_exists ( 'mb_convert_encoding' ) ) { /**
                 * @todo check whether charset is supported - mb_list_encodings
                 */ $ encoded = @ mb_convert_encoding ( $ fileName , $ encoding , 'UTF-8' ) ; if ( @ mb_strlen ( $ fileName , "UTF-8" ) != @ mb_strlen ( $ encoded , $ encoding ) ) { return str_replace ( "\0" , "_" , preg_replace ( "/[^[:ascii:]]/u" , "_" , $ fileName ) ) ; } else { return str_replace ( "\0" , "_" , $ encoded ) ; } } else { return str_replace ( "\0" , "_" , preg_replace ( "/[^[:ascii:]]/u" , "_" , $ fileName ) ) ; } } $ converted = @ iconv ( "UTF-8" , $ encoding . "//IGNORE//TRANSLIT" , $ fileName ) ; if ( $ converted === false ) { return str_replace ( "\0" , "_" , preg_replace ( "/[^[:ascii:]]/u" , "_" , $ fileName ) ) ; } return $ converted ; }
Convert file name from UTF-8 to system encoding

@static
@access public
@param string $fileName
@return string
Convert file name from UTF - 8 to system encoding