Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Foxpro function to convert encoded url

Posted on 2011-02-22
2
1,280 Views
Last Modified: 2012-08-14
Does anyone know of a foxpro functon to convert an encoded url to standard form

for example:

http://www.mysite.com/<font-color=red><b>mytext-2010</b></font>/mytext-p-1473.html?name=Chocolate%20Lover%27s%20Special%20%28USA%29

and convet all the hex character like '%20' to the characters that they represent?

0
Comment
Question by:esak2000
2 Comments
 
LVL 42

Accepted Solution

by:
pcelba earned 400 total points
ID: 34951192
This function is relatively easy:

lcX = "http://www.mysite.com/&lt;font-color=red&gt;&lt;b&gt;mytext-2010&lt;/b&gt;&lt;/font&gt;/mytext-p-1473.html?name=Chocolate%20Lover%27s%20Special%20%28USA%29"

? URL2TXT(lcX)

FUNCTION URL2TXT
LPARAMETERS lcURL

LOCAL lcResult
lcResult = lcURL

DO WHILE "%" $ lcResult
  lcResult = STUFF(lcResult, AT("%", lcResult), 3, HEX2TXT(SUBSTR(lcResult, AT("%", lcResult)+1, 2)))
ENDDO

lcResult = STRTRAN(lcResult, "&"+"lt;", "<")
lcResult = STRTRAN(lcResult, "&"+"gt;", ">")
lcResult = STRTRAN(lcResult, "&"+"amp;", "&")
lcResult = STRTRAN(lcResult, "&"+"quot;", '"')

RETURN lcResult

FUNCTION HEX2TXT
LPARAMETERS lcHex

LOCAL lcStr
lcStr = "0h" + lcHex

RETURN "" + &lcStr

Open in new window

0
 

Author Closing Comment

by:esak2000
ID: 34952634
Thank you, exactly what I was looking for
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question