<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Logic High Blog &#187; fix</title>
	<atom:link href="http://blog.logichigh.com/tag/fix/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.logichigh.com</link>
	<description>Logic High Software Blog</description>
	<lastBuildDate>Sat, 25 Jun 2011 00:39:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Fix a string in PHP for use in Unix Filenames</title>
		<link>http://blog.logichigh.com/2009/02/05/fix-a-string-in-php-for-use-in-unix-filenames/</link>
		<comments>http://blog.logichigh.com/2009/02/05/fix-a-string-in-php-for-use-in-unix-filenames/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 10:13:40 +0000</pubDate>
		<dc:creator>BadPirate</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[slashes]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[unix filename]]></category>

		<guid isPermaLink="false">http://blog.logichigh.com/?p=126</guid>
		<description><![CDATA[Language: PHP Problem: You are trying to use a string as or in a UNIX filename (for instance, passing a filename to a command within the exec() function) and addslashes() falls short because it doesn&#8217;t include spaces or ampersands. Solution: It&#8217;s rough but it works fine.  Run your strings through this function first, and don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.logichigh.com%2F2009%2F02%2F05%2Ffix-a-string-in-php-for-use-in-unix-filenames%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.logichigh.com%2F2009%2F02%2F05%2Ffix-a-string-in-php-for-use-in-unix-filenames%2F&amp;source=badpirate&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Language: PHP</p>
<p>Problem: You are trying to use a string as or in a UNIX filename (for instance, passing a filename to a command within the exec() function) and addslashes() falls short because it doesn&#8217;t include spaces or ampersands.<br />
Solution: It&#8217;s rough but it works fine.  Run your strings through this function first, and don&#8217;t use surrounding quotation marks (no need).  If you&#8217;ve got a better one or have questions, leave a comment <img src='http://blog.logichigh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre name="code" class="php">function makeUnixFilename($string)
 {
 return str_replace("&amp;",'\&amp;',str_replace(" ",'\ ',addslashes($string)));
 }
 </pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.logichigh.com%2F2009%2F02%2F05%2Ffix-a-string-in-php-for-use-in-unix-filenames%2F&amp;title=Fix%20a%20string%20in%20PHP%20for%20use%20in%20Unix%20Filenames" id="wpa2a_2"><img src="http://blog.logichigh.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.logichigh.com/2009/02/05/fix-a-string-in-php-for-use-in-unix-filenames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

