<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: URLEncode (VB Function)</title>
	<atom:link href="http://www.rolbe.com/2009/03/06/urlencode-vb-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rolbe.com/2009/03/06/urlencode-vb-function/</link>
	<description>A Web Development blog by Ryan Olbe</description>
	<lastBuildDate>Sun, 05 Sep 2010 23:33:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Jon</title>
		<link>http://www.rolbe.com/2009/03/06/urlencode-vb-function/comment-page-1/#comment-79</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Sat, 07 Mar 2009 01:16:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.rolbe.com/?p=1695#comment-79</guid>
		<description>You can also do this with the UrlEscape function found in shlwapi.dll.

&lt;pre class=&quot;brush:vb;&quot;&gt;
Public Const URL_DONT_SIMPLIFY As Long = &amp;H8000000
Public Const URL_ESCAPE_PERCENT As Long = &amp;H1000
Public Const URL_ESCAPE_SEGMENT_ONLY As Long = &amp;H2000
Public Const URL_MAX As Long = 3000
Public Const URL_SUCCESS As Long = 0

Public Declare Function UrlEscape Lib &quot;shlwapi&quot; Alias &quot;UrlEscapeA&quot; (ByVal pszURL As String, ByVal pszEscaped As String, pcchEscaped As Long, ByVal dwFlags As Long) As Long
Public Declare Function UrlUnescape Lib &quot;shlwapi&quot; Alias &quot;UrlUnescapeA&quot; (ByVal pszURL As String, ByVal pszUnescaped As String, pcchUnescaped As Long, ByVal dwFlags As Long) As Long

Public Function EncodeURL(ByVal strData As String) As String
 Dim Pos As Long, strTemp As String
 Pos = URL_MAX
 strTemp = Space$(URL_MAX)
 EncodeURL = IIf(UrlEscape(strData, strTemp, Pos, URL_ESCAPE_SEGMENT_ONLY Or URL_ESCAPE_PERCENT) = URL_SUCCESS, Left$(strTemp, Pos), strData)
End Function

Public Function DecodeURL(ByVal strData As String) As String
 Dim Pos As Long, strTemp As String
 Pos = URL_MAX
 strTemp = Space$(URL_MAX)
 DecodeURL = IIf(UrlUnescape(strData, strTemp, Pos, URL_DONT_SIMPLIFY) = URL_SUCCESS, Left$(strTemp, Pos), strData)
End Function
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You can also do this with the UrlEscape function found in shlwapi.dll.</p>
<pre class="brush:vb;">
Public Const URL_DONT_SIMPLIFY As Long = &amp;H8000000
Public Const URL_ESCAPE_PERCENT As Long = &amp;H1000
Public Const URL_ESCAPE_SEGMENT_ONLY As Long = &amp;H2000
Public Const URL_MAX As Long = 3000
Public Const URL_SUCCESS As Long = 0

Public Declare Function UrlEscape Lib "shlwapi" Alias "UrlEscapeA" (ByVal pszURL As String, ByVal pszEscaped As String, pcchEscaped As Long, ByVal dwFlags As Long) As Long
Public Declare Function UrlUnescape Lib "shlwapi" Alias "UrlUnescapeA" (ByVal pszURL As String, ByVal pszUnescaped As String, pcchUnescaped As Long, ByVal dwFlags As Long) As Long

Public Function EncodeURL(ByVal strData As String) As String
 Dim Pos As Long, strTemp As String
 Pos = URL_MAX
 strTemp = Space$(URL_MAX)
 EncodeURL = IIf(UrlEscape(strData, strTemp, Pos, URL_ESCAPE_SEGMENT_ONLY Or URL_ESCAPE_PERCENT) = URL_SUCCESS, Left$(strTemp, Pos), strData)
End Function

Public Function DecodeURL(ByVal strData As String) As String
 Dim Pos As Long, strTemp As String
 Pos = URL_MAX
 strTemp = Space$(URL_MAX)
 DecodeURL = IIf(UrlUnescape(strData, strTemp, Pos, URL_DONT_SIMPLIFY) = URL_SUCCESS, Left$(strTemp, Pos), strData)
End Function
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Filipe</title>
		<link>http://www.rolbe.com/2009/03/06/urlencode-vb-function/comment-page-1/#comment-78</link>
		<dc:creator>Filipe</dc:creator>
		<pubDate>Sat, 07 Mar 2009 00:09:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.rolbe.com/?p=1695#comment-78</guid>
		<description>What happens to &quot;http://&quot; (and other) chars within the server address?

Url encoding should only be done in the subfolder, file and params.

ex: http&#058;&#047;&#047;www.myserver.com/mydirectory/file1.htm?param1=test
in this case would result:
http%3A%2F%2Fwww.myserver.com%2Fmydirectory%2Fmyfile%2Ehtm%3Fparam1%3Dtest

However, this is good code for param/file/directory name encoding once you only encode the right places. :)</description>
		<content:encoded><![CDATA[<p>What happens to "http://" (and other) chars within the server address?</p>
<p>Url encoding should only be done in the subfolder, file and params.</p>
<p>ex: http&#58;&#47;&#47;www.myserver.com/mydirectory/file1.htm?param1=test<br />
in this case would result:<br />
http%3A%2F%2Fwww.myserver.com%2Fmydirectory%2Fmyfile%2Ehtm%3Fparam1%3Dtest</p>
<p>However, this is good code for param/file/directory name encoding once you only encode the right places. <img src='http://www.rolbe.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
