Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Escape/UnEscape functions
Message
 
To
20/11/2001 18:26:29
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
00584241
Message ID:
00584305
Views:
38
Hmmm... I didn't know this one existed either. I was going to be stoked about being able to drop some C DLL code I have in use for this...

But, I just tried it but it doesn't appear to work quite right either as this is meant to be an API for encoding URLs not to decode formvariable data.
DECLARE Integer UrlEscape IN Shlwapi.dll ;
   String pszUrl,;
   String @pszEscaped,;
   INTEGER @pcchEscaped,;
   INTEGER Flags

lcString ="Give me  break!" + CHR(13) + CHR(10) + "Enough already!" + CHR(133)   
   
lcBuffer = SPACE(255)   
lnSize = LEN(lcBuffer)
? UrlEscape(lcString,@lcBuffer,@lnSize,0)

? lcBuffer

* ? UrlEncode(lcString)   && compare against wwUtils

RETURN
At first I had this not work at all because it quit at # or ? characters (whihc I removed above). If your string has those values in it, it would fail - as far as I can see in the API ref there's no way to to override this default setting.

Also the CHR(133) isn't encoded for some reason and it definitely should be. Finally the API is limited to INTERNET_MAX_URL_LENGTH (a little over 2k) so if you pull some long strings from somewhere this can be problematic.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform