kohana-storage icon indicating copy to clipboard operation
kohana-storage copied to clipboard

Different OS local file system path encoding

Open liaosankai opened this issue 11 years ago • 0 comments

How about add charset param for different OS local file system path character encode?

Add new param to kohana-storage\config\storage.php

// REQUIRED - OS file system path default encoding
$config['local']['charset'] = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
? "ASCII" : "UTF-8";

Add function to kohana-storage\classes\Storage\Connection\Local.php

/**
 * Convert path string to requested character encoding
 *
 * @access  protected
 * @param   string $path path without encoding
 * @return  string
 */
protected function _iconv_path($path)
{
    return = iconv("UTF-8", "{$this->_config['charset']}//IGNORE", $path);
}

and add $path = $this->_iconv_path($path); to first line on per function with $path param.

liaosankai avatar Jan 12 '14 11:01 liaosankai