Solved

Foxpro function to convert encoded url

Posted on 2011-02-22
2
1,236 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 41

Accepted Solution

by:
pcelba earned 400 total points
Comment Utility
This function is relatively easy:

lcX = "http://www.mysite.com/<font-color=red><b>mytext-2010</b></font>/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
Comment Utility
Thank you, exactly what I was looking for
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now