Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Server.HTMLEncode equivalent for VFP?
Message
From
26/12/2000 15:07:40
 
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00456699
Message ID:
00456903
Views:
24
Mark,

You can view source for this page and see what he meant. Look for missing "< p >" and "< br >" in the DisplayMemo function.

>Rick, I think your code example got garbeled because of UT's own HTML stripping.
>
>>>
>>>Can anbody recommend how to use Server.HTMLEncode for IIS (assuming either IIS or PWS is installed on the same PC) from within VFP, or otherwise get the equivalent functionality of Server.HTMLEncode from within VFP? In other words, I need a text-to-HTML encoding function that translates ">" and "<" and other special characters to the appropriate > and < syntax. Thanks.
>>>

>>
>>I usually use two functions for this (mainly for displaying HTML and code
>>in an HTML document):
>>
>>
>>************************************************************************
>>Function FixHTMLForDisplay
>>************************************************************************
>>#IF .F.
>>*:Help Documentation
>>*:Topic:
>>wwUtils::FixHTMLForDisplay
>>
>>*:Description:
>>This method fixes up HTML for display. Takes HTML and XML tags and converts
>>them to HTML displayable characters (< for < for example).
>>
>>*:Parameters:
>><>lcHTML<>
>>HTML to fix up.
>>
>>*:Returns:
>>Fixed up HTML
>>*:ENDHELP
>>#ENDIF
>>************************************************************************
>>LPARAMETER lcHTML
>>
>>lcHTML = STRTRAN(lcHTML,"<","<")
>>lcHTML = STRTRAN(lcHTML,">",">")
>>lcHTML = STRTRAN(lcHTML,["],""")
>>
>>RETURN lcHTML
>>
>>
>>************************************************************************
>>FUNCTION DisplayMemo
>>**************************
>>*** Function: Fixes linebreaks into HTML breaks
and


>>*** Pass: lcHTML - HTML to fix
>>*** Return: Fixed HTML
>>*************************************************************************
>>LPARAMETER lcHTML
>>
>>lcHTML = STRTRAN(lcHTML,CHR(13)+CHR(10),CHR(13))
>>lcHTML = STRTRAN(lcHTML,CHR(10),CHR(13))
>>lcHTML = STRTRAN(lcHTML,CHR(13)+CHR(13),"

")
>>
>>RETURN STRTRAN(lcHTML,CHR(13),"
")
>>* FixHTMLLineBreaks
>>

David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Reply
Map
View

Click here to load this message in the networking platform