?
Solved

Foxpro function to convert encoded url

Posted on 2011-02-22
2
Medium Priority
?
1,334 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
[X]
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
2 Comments
 
LVL 43

Accepted Solution

by:
pcelba earned 1600 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

650 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