Created
April 7, 2011 19:59
-
-
Save kanonji/908595 to your computer and use it in GitHub Desktop.
Remove ASCII unavailable for filename
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* \x00-\x1f\x7f: Controll Characters | |
* \x22 " | |
* \x2a * | |
* \x2f / | |
* \x3a : | |
* \x3c < | |
* \x3e > | |
* \x3f ? | |
* \x5c \ | |
* \x7c | | |
*/ | |
function removeOfWindows( $str ){ | |
return preg_replace('/[\x00-\x1f\x7f\x22\x2a\x2f\x3a\x3c\x3e\x3f\x5c\x7c]/', '', $str ); | |
} | |
function removeOfMac( $str ){ | |
return preg_replace('/[\x00-\x1f\x7f\x3a]/', '', $str ); | |
} | |
function removeOfLinux( $str ){ | |
return preg_replace('/[\x00-\x1f\x7f\x2f]/', '', $str ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment