Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automate email
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00826623
Message ID:
00832531
Views:
24
Peter,

According to http://www.faqs.org/rfcs/rfc1738.html "only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL". So I would rather use Rick's function and encode more characters than get error in the application. I don't think the speed would be an issue here because you wouldnt use it to send big messages anyway.

>Today I've written a routine that should suffice for email. But I'm not entirely sure about it.
>Doubt 1: Is it sufficient to encode only some special characters?
>Doubt 2: Did I catch all relevant special characters?
>
>I wonder what you guys have to say about it. (The advantage over Rick's UrlEncode() is speed.)
>
>
*	Inspired by the routine UrlEncode from Rick Strahl, but entirely different.
>*	See also:
>*	http://www.west-wind.com/presentations/shellapi/shellapi.asp
>*	http://www.faqs.org/rfcs/rfc2368.html
>
>FUNCTION EncodeForEMail( tcString )
>
>	local lcString
>
>	lcString = strtran( tcString, "%", "%25" )	&& This one must be the first!
>	lcString = strtran( lcString, "?", "%3F" )
>	lcString = strtran( lcString, "&", "%26" )
>	lcString = strtran( lcString, "=", "%3D" )
>	lcString = strtran( lcString, chr(13)+chr(10), "%0D%0A" )
>	lcString = strtran( lcString, chr(13)        , "%0D%0A" )
>
>	RETURN lcString
>
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform