>>As I have long said, you need to use language-pack keyboards for your special characters, not utf8 characters
what relation the keyboard has to the filesystem-related file name encoding ?
any modern linux OS have “xx_XX.UTF8” encoding as default.
and if anyone need to display files, it’s returned by the OS without any keyboard interaction ??
setlocale() in PHP it’s a bad thing and most easy way – it to fix related buggy finction. without ANY relation to utf or unicode.
I publish some example above. may I suggest another ?
class UTF
{
public static $ON = false;
static public function pathinfo($path_file, $options = NULL)
{
if (self::$ON) {
$path_file = strtr($path_file,array('\\'=>'/'));
preg_match("~[^/]+$~",$path_file,$file);
preg_match("~([^/]+)[.$]+(.*)~",$file[0],$file_ext);
preg_match("~(.*)[/$]+~",$path_file,$dirname);
if (!$dirname[1]) $dirname[1]='.';
$result = array('dirname' => $dirname[1],
'basename' => $file[0],
'extension' => (isset($file_ext[2]))?$file_ext[2]:false,
'filename' => (isset($file_ext[1]))?$file_ext[1]:$file[0]
);
if ($options & PATHINFO_DIRNAME) return $result['dirname'];
if ($options & PATHINFO_BASENAME) return $result['basename'];
if ($options & PATHINFO_EXTENSION) return $result['extension'];
if ($options & PATHINFO_FILENAME) return $result['filename'];
return $result;
}
else {
if ($options) return pathinfo($path_file, $options);
else return pathinfo($path_file);
}
}
}
it performance impact are small for OFF state and if anyone need it, just need to execute UTF::$ON=true
thru plugin options