note 41468 added to function.htmlentities
| From: | GuillaumeBeaulieu at rn2 dot php dot net | Date: | Sun, 11 Apr 2004 18:10:31 +0000 |
| Subject: | note 41468 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67984@lists.php.net to get a copy of this message | ||
Here's a simple script to transform filename with accented character in it into much more
usable unaccented character for a restrictive filesystem.
$string = htmlentities($stringToModify);
/* Take the first letter of the entity (if you got filename with ([<>] in it the result will
probably remain lookable*/
$string = preg_replace("/\&(.)[^;]*;/", "\\1", $string);
/* Change the whitespace into _*/
$string = preg_replace("/[ ]/", "_", $string);
/* Dance ! */
print $string;
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41468
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41468&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41468&report=yes
Search -- http://master.php.net/manage/user-notes.php