<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.4" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Filename safe</title>
	<link>http://phpit.net/code/filename-safe/</link>
	<description>PHPit has dozens of PHP articles, codesnippets and FAQ's.</description>
	<pubDate>Fri, 16 May 2008 03:47:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>

	<item>
		<title>by: Dennis Pallett</title>
		<link>http://phpit.net/code/filename-safe/#comment-116</link>
		<pubDate>Wed, 16 Nov 2005 20:29:13 +0000</pubDate>
		<guid>http://phpit.net/code/filename-safe/#comment-116</guid>
					<description>Thanks for sharing!</description>
		<content:encoded><![CDATA[<p>Thanks for sharing!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: maxhb</title>
		<link>http://phpit.net/code/filename-safe/#comment-115</link>
		<pubDate>Wed, 16 Nov 2005 17:01:05 +0000</pubDate>
		<guid>http://phpit.net/code/filename-safe/#comment-115</guid>
					<description>Hi!
The following will convert any string to filesystem safe characters and handle german umlauts as well.
In favor of the above solution this one is faster and more reliable as it e.g. preserves dots within filenames which are usually used to separate filenames and file extensions.

function safe_filename ($filename) {
	$search = array(
		// Definition of German Umlauts START
		'/ß/',
		'/ä/','/Ä/',
		'/ö/','/Ö/',
		'/ü/','/Ü/',
		// Definition of German Umlauts ENDE
		'([^[:alnum:]._])' // Disallow: Not alphanumeric, dot or underscore
	);
	$replace = array(
		'ss',
		'ae','Ae',
		'oe','Oe',
		'ue','Ue',
		'_'
	);
	return preg_replace($search,$replace,$filename);
}</description>
		<content:encoded><![CDATA[<p>Hi!<br />
The following will convert any string to filesystem safe characters and handle german umlauts as well.<br />
In favor of the above solution this one is faster and more reliable as it e.g. preserves dots within filenames which are usually used to separate filenames and file extensions.</p>
<p>function safe_filename ($filename) {<br />
	$search = array(<br />
		// Definition of German Umlauts START<br />
		&#8216;/ß/&#8217;,<br />
		&#8216;/ä/&#8217;,'/Ä/&#8217;,<br />
		&#8216;/ö/&#8217;,'/Ö/&#8217;,<br />
		&#8216;/ü/&#8217;,'/Ü/&#8217;,<br />
		// Definition of German Umlauts ENDE<br />
		&#8216;([^[:alnum:]._])&#8217; // Disallow: Not alphanumeric, dot or underscore<br />
	);<br />
	$replace = array(<br />
		&#8217;ss&#8217;,<br />
		&#8216;ae&#8217;,'Ae&#8217;,<br />
		&#8216;oe&#8217;,'Oe&#8217;,<br />
		&#8216;ue&#8217;,'Ue&#8217;,<br />
		&#8216;_&#8217;<br />
	);<br />
	return preg_replace($search,$replace,$filename);<br />
}
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
