<?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>GuShH&#039;s DevBlog &#187; standards</title>
	<atom:link href="http://gushh.net/blog/?tag=standards&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://gushh.net/blog</link>
	<description>This blog is about software, electronics engineering and game development.</description>
	<lastBuildDate>Tue, 24 Jan 2012 00:31:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>URL Encoding in PureBasic, the proper way.</title>
		<link>http://gushh.net/blog/url-encoding-in-purebasic-the-proper-way/</link>
		<comments>http://gushh.net/blog/url-encoding-in-purebasic-the-proper-way/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 06:07:57 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[pb]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[rfc 3986]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[uri encode]]></category>
		<category><![CDATA[url encoding]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/index.php/2008/03/30/url-encoding-in-purebasic-the-proper-way/</guid>
		<description><![CDATA[The other day I found myself in the need of a compliant url-encoding routine for the PB language, not surprisingly theres none available by default (there are actually no specialized libraries whatsoever, and the little you see is implemented from third-party code&#8230;). So I had to code my own, as always. When no proper framework [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I found myself in the need of a compliant url-encoding routine for the PB language, not surprisingly theres none available by default (there are actually no specialized libraries whatsoever, and the little you see is implemented from third-party code&#8230;).</p>
<p>So I had to code my own, as always. When no proper framework is given, you have to either depend on others to implement it or just do it yourself, since the former requires time and patience&#8230; I always choose the latter <img src='http://gushh.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Heres a standards compliant routine to URL-Encode URIs in PureBasic:</p>
<p>The url_encode() code can be found at &gt; <a HREF="http://gushh.net/src.php?file=pb/URLEncode_rfc3986.pb" TITLE="URLEncode_rfc3986_purebasic">here</a> &lt;</p>
<p><span id="more-18"></span></p>
<p>It complies with the RFC 3986 (the current standard) and it&#8217;s the fastest method available for the language. In my last benchmarks it proved to be 0.20 times faster than the fastest known/shared url-encode routine for this language (however, that one wasn&#8217;t compliant at all!). It&#8217;s also 2.50 times faster than the average suggested &#8220;solutions&#8221; for URL-Encoding in this language.</p>
<p>Notice the character &#8216;%&#8217; being checked in one of the case statements, this is simply to prevent duplicate percent-encodings on already encoded URIs. Speed wise, you could still further optimize this routine here and there, but I personally think it&#8217;s not worth the hassle (readability is still important).</p>
<p><em>The reason I always optimize my routines once I&#8217;m done developing them is simply due to the fact that every little uop you save (or should I say &#8216;shave&#8217;?) counts, whether it&#8217;s a trivial operation or not, it doesn&#8217;t matter! &#8211; that&#8217;s simply a clue: It&#8217;ll give you a reference on how many time you should spend optimizing the routine. Yet in the case of a trivial operation, it doesn&#8217;t mean you should leave it &#8220;as is&#8221;. Again, just because you&#8217;ll call the routine once or twice during runtime doesn&#8217;t mean you can&#8217;t improve it!.</em></p>
<p>Thus if you can up-scale your code, then do it. Not only you&#8217;ll gain execution speed, but also knowledge; that&#8217;s a precious thing to earn.</p>
<g:plusone href='http://gushh.net/blog/url-encoding-in-purebasic-the-proper-way/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/url-encoding-in-purebasic-the-proper-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: gushh.net @ 2012-02-09 07:32:38 by W3 Total Cache -->
