$dir .= '_';
} else {
$c = $chars[$i];
- if ( ord( $c ) >= 128 || ctype_alnum( $c ) ) {
+ if ( ord( $c ) >= 128 || preg_match( '/[a-zA-Z0-9!#$%&()+,[\]^_`{}-]/', $c ) ) {
if ( function_exists( 'mb_strtolower' ) ) {
$dir .= mb_strtolower( $c );
} else {
c = dbk.charAt(i);
cc = dbk.charCodeAt(i);
- if (cc >= 128 || /[a-zA-Z0-9]/.exec(c)) {
+ if (cc >= 128 || /[a-zA-Z0-9!#$%&()+,[\]^_`{}-]/.exec(c)) {
dir += c.toLowerCase();
} else {
- dir += binl2hex([cc]);
+ dir += binl2hex([cc]).substr(0,2).toUpperCase();
}
}
}