static private function detectPathEncoding() {
        if (self::$pathEncoding) {
            return;
        }
        foreach (explode(';', setlocale(LC_ALL, 0)) as $i) {
            $i = explode('=', $i);
            if ($i[0] === 'LC_CTYPE') {
                $tmp = preg_replace('|^.*[.]|', '', $i[1]);
                if (is_numeric($tmp)) {
                    self::$pathEncoding = 'windows-' . $tmp;
                    break;
                } else if (preg_match('|utf-?8|i', $tmp)) {
                    self::$pathEncoding = 'utf-8';
                    break;
                } else {
                    throw new RuntimeException('Operation system encoding can not be determined');
                }
            }
        }
    }