Solved

Foxpro function to convert encoded url

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

726 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