diff options
author | Andreas Gohr <andi@splitbrain.org> | 2010-04-04 20:28:39 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2010-04-04 20:28:39 +0200 |
commit | f03fd957525a714da1cde7e2957939046bd51bd5 (patch) | |
tree | ad10bc8fee061ff42efa36c18b5902952e079493 /inc/utf8.php | |
parent | 70e083cec45ef4a738ae0b3f20af8e4f288a7dfa (diff) | |
download | rpg-f03fd957525a714da1cde7e2957939046bd51bd5.tar.gz rpg-f03fd957525a714da1cde7e2957939046bd51bd5.tar.bz2 |
new fnencode option FS#1649
This patch adds an option to choose how filenames are encoded
when saved to the file system. You can choose between urlencoding
(url), the new SafeFn method (safe) and storing real UTF-8 (utf-8).
Diffstat (limited to 'inc/utf8.php')
-rw-r--r-- | inc/utf8.php | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/inc/utf8.php b/inc/utf8.php index b078540d2..c10e33ffa 100644 --- a/inc/utf8.php +++ b/inc/utf8.php @@ -19,45 +19,6 @@ if(!defined('UTF8_MBSTRING')){ if(UTF8_MBSTRING){ mb_internal_encoding('UTF-8'); } -if(!function_exists('utf8_encodeFN')){ - /** - * URL-Encode a filename to allow unicodecharacters - * - * Slashes are not encoded - * - * When the second parameter is true the string will - * be encoded only if non ASCII characters are detected - - * This makes it safe to run it multiple times on the - * same string (default is true) - * - * @author Andreas Gohr <andi@splitbrain.org> - * @see urlencode - */ - function utf8_encodeFN($file,$safe=true){ - if($safe && preg_match('#^[a-zA-Z0-9/_\-.%]+$#',$file)){ - return $file; - } - $file = urlencode($file); - $file = str_replace('%2F','/',$file); - return $file; - } -} - -if(!function_exists('utf8_decodeFN')){ - /** - * URL-Decode a filename - * - * This is just a wrapper around urldecode - * - * @author Andreas Gohr <andi@splitbrain.org> - * @see urldecode - */ - function utf8_decodeFN($file){ - $file = urldecode($file); - return $file; - } -} - if(!function_exists('utf8_isASCII')){ /** * Checks if a string contains 7bit ASCII only |